Mail Archives: djgpp/1998/07/07/08:52:52
In article <01bdaa6b$8b24a8a0$e822b0c2 AT Giedrius DOT omnitel DOT net> you wrote:
> I'm a beginner and I'd like to know what's the difference between,
> for example, 'asm' and '__asm__' or 'volatile' and '__volatile__' etc.?
In ANSI C, the set of keywords is fixed by the ANSI standard. 'asm' is
not one of them, so gcc in ANSI-compatibility mode (gcc -ansi
-pedantic) is not allowed to recognize 'asm' as a keyword. But all
names beginning with a double '_' are reserved to the implementation,
so '__asm__' may be used as a keyword even in this mode.
For 'volatile' the situation is the other way round, I think: 'volatile'
is a new keyword that didn't exist in pre-ANSI C. So 'gcc -traditional'
doesn't recognize it. For similar reasons as above, '__volatile__' is
still available.
So, in a nutshell:
If you want your program to be maximally ANSI compliant, use '__asm__'
and 'volatile'. (But using '__asm__' still obviously means you won't
be able to compile the source on anything but gcc, so you might just
as well use 'asm' right away).
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -