Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Trying to understand what an "Alias" (concerning arrays) is

Rob
2019-10-18
2019-10-19
  • Rob - 2019-10-18

    Hi everybody,
    The Codesys online help isn't helping me too much to understand what an "Alias" is.
    Could someone perhaps show me a little example of an implementation of it?
    Particularly it interests me concerning arrays...
    Thanks in advance,
    Rob

    IMG: Capture1.PNG

     
  • i-campbell

    i-campbell - 2019-10-18

    Alias means "another name for".
    Alias in CODESYS is a user defined data type (DUT).
    So if you make ThirtyTwoBytes an Alias of ARRAY [0..31] OF BYTE, you can declare myVar : ThirtyTwoBytes; or myVar1 : ARRAY [0..31] OF BYTE; and they'll be the same data type.

    I know another programming software where you have alias variables, but in CODESYS you have alias types.

     
  • Rob - 2019-10-19

    Thanks I-Campbell, your explanation helped me to understand an alias assignment isn't what I had figured out.
    I thought the alias could be assigned to the array elements, not to the array itself.
    Is this possible in anyway though? (assigning alias to array elements)

     

Log in to post a comment.