This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

assign an absolute memory location

I am kind of confused about using the _at_ keyword to assign a specific address to a variable.

so for example :

extern xdata char variable _at_ 0x000f;

it fills 3 bytes in xram . can any one explain how is the compiler handling these sequence. Thank you !

Parents Reply Children
  • 'extern' is not a non-standard extension.

    Come on. You know that I was not referring to extern.

    It's probably better if you don't snip away the context like that.

    The context says that Erik should compile a line that contains not just one, but two blindingly obvious non-standard keywords and look at the resulting assembly, and that he would find the explanation for the results in "the standard".

    Yes?

  • 'extern' is not a non-standard extension.

    Come on. You know that I was not referring to extern.

    Yes, but equally you know that I was not referring to __at__.

    The context says that Erik should compile a line that contains not just one, but two blindingly obvious non-standard keywords and look at the resulting assembly, and that he would find the explanation for the results in "the standard".

    Yes. The code posted does not behave the way he thinks it does, this is because of is his misunderstanding of 'extern'.

  • "Warning--A message emitted by a compiler to try and convince the programmer that some program construct is likely confusing, wrong, or dangerous. Because of the serious nature of warnings, most compilers have a provision to turn most of them off. The rest typically go to /dev/null."

  • Yes, but equally you know that I was not referring to __at__.

    You were referring to a declaration that contains non-standard keywords, and basically by definition the standard cannot describe what the compiler should do with such a line.

    Interestingly enough, the compiler documentation contains detailed examples on how to define variables using the _at_ keyword, and how to use these variables in a different source file than they were declared in.

  • You were referring to a declaration that contains non-standard keywords, and basically by definition the standard cannot describe what the compiler should do with such a line.

    You are missing the point. The issue in hand is that the 'extern' keyword, when applied to a variable definition, does not make it an "extern ref".

    Interestingly enough, the compiler documentation contains detailed examples on how to define variables using the _at_ keyword, and how to use these variables in a different source file than they were declared in.

    I should hope the manual documents the usage of all non-standard extensions.