Programs can be cross-compiled. The machine and environment where the program is compiled can have a different character set from the environment where the compiled program executes.
In principle, we could be working with a C program whose source code is written in ASCII, on an ASCII operating system like Unix, but be cross-compiling it to a machine which uses a different representation of text, like EBCDIC.
So for instance in the source code, the character constant 'A'
is represented by the ASCII character 65, but the cross-compiler must map that to the EBCDIC value of A
which is 193.
The specification for a language that can support cross-compiling need to be carefully worded. For instance, the requirement cannot be stated like "the value of a character constant consisting of a single unescaped character between single quotes is the code point value of that character". Instead, we specify it in terms of mapping between translation and execution character sets.
About $
, @
and `
, the simple fact is that they are not used in the language: they don't serve as punctuators and are not parts of identifiers. These characters may occur in comments, if they are part of the translation character set, and in character constants and string literals if they have a mapping to the translation character set.
The C language could be implemented in a hypothetical environment which lacks these characters. Therefore, a strictly conforming program cannot use them for any purpose, not even in a comment. When they are used in a program, and the program is accepted, it is an extension. In other words, when you use the full ASCII character set in your C programs, you're relying on a language extension (a very common one).
C implementations can also use these characters for extensions. For instance, some compilers allow $
in identifiers, and that may be necessary in order to connect with some external names (like in assembly language). The Objective C dialect used @
as a prefix for its extensions.