We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
What is the difference between the following two variable declaration?
unsigned char var; and unsigned char data var;
Will do thru the link... & will get back to you incase of further queries...
Thank you.
Hello Sir,
Got the difference. The memory alocation depends on the "memory model" you select. Accordingly, a byte will be allocated at the appropriate place.
Thank you for the link.
Regards, Dipen
"The memory alocation depends on the 'memory model'"
The first one depends upon the memory model; the second one doesn't, because it specifies the memory space explicitly.
Yes exactly. Now I have understood it properly.
Now what if there isnt any external memory IC (RAM) connected & you select a model other than SMALL?
According to me, all operations with that variable will be done with a "garbage" value.
Your question implies is that the assembler/compiler/linker should 'know' what you have, it does not, unless you tell it what you have.
Erik
"According to me, all operations with that variable will be done with a "garbage" value."
Yes, that's right.
If you tell the tools to use XRAM they will do so. As Erik says, they have no way of knowing what may or may not be present in your target hardware - they just do as they are told.