About Using "Alias"
I'm turning a structure type variable with words and bytes into an array so I can handle and pass it easily.
So in this array of bytes I have to insert byte and word values.
With this statement you are given an error:
Dim smeteo (20) as byte
Dim Pressure As Word Alias smeteo (12), smeteo(13)
Error: Size of alias variable (4) does not match number of locations (2).
But doesn't a word variable take up two bytes?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My mistake!
I had already sized the Pressure variable as long.
When I renamed the names of the variables (which were in a struct, therefore NameStruct.NameVar) two variables were created with the same name, one long and the other word.
The compiler rightly took the first one created as valid.
Thanks to your help, seeing that you were fine with it, I investigated the very complex and long code and found the error.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
About Using "Alias"
I'm turning a structure type variable with words and bytes into an array so I can handle and pass it easily.
So in this array of bytes I have to insert byte and word values.
With this statement you are given an error:
Dim smeteo (20) as byte
Dim Pressure As Word Alias smeteo (12), smeteo(13)
Error: Size of alias variable (4) does not match number of locations (2).
But doesn't a word variable take up two bytes?
Interesting ... I update the compiler last week to improve error messages when using Alias.
But, this works here.
ASM looks correct. SMETEO is at RAM address 475 add 12 = 47. Pressure is at 487 & 488.
What is your full program as I cannot reproduce?
My mistake!
I had already sized the Pressure variable as long.
When I renamed the names of the variables (which were in a struct, therefore NameStruct.NameVar) two variables were created with the same name, one long and the other word.
The compiler rightly took the first one created as valid.
Thanks to your help, seeing that you were fine with it, I investigated the very complex and long code and found the error.