J
JustBoo
Whilst reading through the C++ FAQ. I came across Section 29.8 and
realized I never had fully thought about where a #define resided in a
Standard C++ program.
I thought they were a compile-time entity where the preprocessor
"searched and replaced" the "symbol" with the literal value that had
been assigned with the #define.
From the FAQ, Section 29.8
<quote>
Every #define macro effectively creates a new keyword in every source
file and every scope until that symbol is #undefd. The preprocessor
lets you create a #define symbol that is always replaced independent
of the {...} scope where that symbol appears.
</quote>
Is this only at compile time? Are all #defines put into a global
symbol table? Or... ?
I guess I've been working from a "rote mode" all these years in regard
to #defines. (Which are evil.)
PS: I tried many search term permutations in Google with this and
literally none were less than 2 million hits. Too much can be the
same as none at all.
Thanks in advance.
realized I never had fully thought about where a #define resided in a
Standard C++ program.
I thought they were a compile-time entity where the preprocessor
"searched and replaced" the "symbol" with the literal value that had
been assigned with the #define.
From the FAQ, Section 29.8
<quote>
Every #define macro effectively creates a new keyword in every source
file and every scope until that symbol is #undefd. The preprocessor
lets you create a #define symbol that is always replaced independent
of the {...} scope where that symbol appears.
</quote>
Is this only at compile time? Are all #defines put into a global
symbol table? Or... ?
I guess I've been working from a "rote mode" all these years in regard
to #defines. (Which are evil.)
PS: I tried many search term permutations in Google with this and
literally none were less than 2 million hits. Too much can be the
same as none at all.
Thanks in advance.