The documentation regarding aliasing variables isn't entire clear to me. So here my question. I setup an array CMD(4) and then I want to alias four variables to each of the four elements of the array. Is this the correct way?
DIM CMD(4) AS BYTE
DIM CMD0 AS BYTE ALIAS CMD(1)
DIM CMD1 AS BYTE ALIAS CMD(2)
DIM CMD2 AS BYTE ALIAS CMD(3)
DIM CMD3 AS BYTE ALIAS CMD(4)
Last edit: miniTesla 2026-05-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The optimiser will create aliases automatically if the address of the array elements is a constant. So, uses the alias does make use of the array elements easier but it will not improve code size.
Best to look at the ASM. There is an alias section.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you can provide the location in the help ( the page in the CHM ... use the properties of the page to tell you the source file name, it will look like /_alias.html
And, the words you recommend then we can just drop in.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The example that is there isn't mine. I have no idea what my_variable_E is. Explain it. My example from above for an array doesn't need more than something like "accessing array elements via aliasing"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The documentation regarding aliasing variables isn't entire clear to me. So here my question. I setup an array CMD(4) and then I want to alias four variables to each of the four elements of the array. Is this the correct way?
Last edit: miniTesla 2026-05-05
Yes, this is correct.
The optimiser will create aliases automatically if the address of the array elements is a constant. So, uses the alias does make use of the array elements easier but it will not improve code size.
Best to look at the ASM. There is an alias section.
Perhaps this can be added as example in the aliasing section. Also this example that is already in the docu
would benefit from an explantion of what my_variable_E, my_variable_U, my_variable_H are because they are not defined.
Where?
If you can provide the location in the help ( the page in the CHM ... use the properties of the page to tell you the source file name, it will look like /_alias.html
And, the words you recommend then we can just drop in.
Where aliasing is described. https://gcbasic.sourceforge.io/help/_variable_types.html
And, the words you recommend then we can just drop in and where in the document?
The example that is there isn't mine. I have no idea what my_variable_E is. Explain it. My example from above for an array doesn't need more than something like "accessing array elements via aliasing"
Here is a draft.
https://github.com/GreatCowBASIC/Help/blob/main/source/varbytes.adoc
Please edit/revise.
This is good and much better than what is currently there. My main confusion came from the E, U, H naming convention that is now explained.