What does @ operator do?
Or does such an operator even exist in standard C/C++?
While programming Microchip Controllers in C, a popular compiler uses @ operator to define variables at a given address inside the memory. For example volatileunsignedchar ABC @ 0x0A
declares an 8-variable called ABC at the address 0x0A in the data memory of uC.
Is it a standard procedure? While programming inside an operating system, is it possible to use @ to define and therefore access a specific memory location?
Thanks. I was just wondering, if that was a standard C++ operator, that'd render the memory management modules of the operating system purposeless, every program for itself. But clearly, that is not the case...
Most probably, that is a facility only in uC programming because 1) it has a smaller memory and to access those memory locations, you have to take extreme care, 2) the control registers and data memory share the same memory chunk. So that may be why Hi-Tech C Compiler allows that operator.
BTW, C++ has "placement new" which does the same thing. volatileunsignedchar* ABC = new (0xa) unsignedchar; would create a variable ABC which points to memory location 0xa.