I came to this obscure thing ... I would like to know if there are any possibilities for the @ sign to appear in the source of a valid C/C++ application, beside of the following situations:
- a
const char*value such asconst char* addr = "[email protected]" - a
const charvalue, such aschar c = '@' - a macro which is never used:
#define NEVER_EVER ABC@ - in a commented out section
Reason for asking: curiosity :)
There isn't any problem with all the above.
The @ is invalid in names (variables, functions, classes, etc.) Some linkers actually use the @ character as "at" meaning to relate symbols to libraries. (try to
nmsome of your executables in Linux); you'll see something like this:malloc@@GLIBC_2.2.5meansmalloctaken from GLIBC_2.2.5.In strings and characters, the only problematic seen character is the
\which is also used as an escape character and the"in strings and'in characters which must be escaped to not be translated as end of string/character.In comments, there aren't any limitations except the
*/in multi-line comment which will close the comment.A never-used macro does not really exist after precompilation, so there isn't any problem at all.