macro expansion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have been playing around with gcc Pre-Processor and I cannot explain one 
behavior.
The code bellow demonstrate my question.

Input file : 
--------------------------------------- 
#define START_WITH_A_NUMBER      0_start_with_a_number
#define START_WITH_A_LETTER        a_start_with_a_letter
#define I_LOVE_SPACE                      I       love       space
START_WITH_A_NUMBER+0
START_WITH_A_LETTER+0
I_LOVE_SPACE
--------------------------------------- 

Pre-processed output (gcc -E -P myfile):
--------------------------------------- 
0_start_with_a_number +0
a_start_with_a_letter+0
I love space
--------------------------------------- 

1) Why is there a space after '0_start_with_a_number' whereas no space is 
present after 'a_start_with_a_letter'? 

2) Why does gcc remove the spaces inside the replacement list of  I_LOVE_SPACE?
3) Does it serve a purpose?
4) Is there a PP flag to force gcc to pre-process by the standard?
Thanks

Matti

P.S: 
- gcc version 3.4.5 (mingw-vista special r3)
- '16.3 Macro replacement' chapter from a C++ spec did not help me to understand 
gcc behavior.



      



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux