Sign in to follow this  

@ - Symbol in C/C++?

This topic is 3102 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Quick and probably stupid question here. I've seen a few code examples with the "@" symbol when defining constants and can't find anywhere what they mean...for example: #define SOMETHING @0x00 Whats it all about? Cheers!

Share this post


Link to post
Share on other sites
It is non-standard, so you have to check your compiler's documentation. Some use I've seen for it is to force the variable's location in memory, to make an alias for a memory mapped register for example.

Share this post


Link to post
Share on other sites
Inside a macro (a.k.a. #define), the @ symbol means that the thing that follows is a character.

If you have a copy of the language standards handy, search for @\n for an example usage.


So @0x00 would mean to use the character value 0, with no other parsing or replacement.

Share this post


Link to post
Share on other sites
In other words, it's a way for somebody to embed NULL character directly in their source file, for some reason.

Share this post


Link to post
Share on other sites
Sign in to follow this