Mail Archives: djgpp/1996/04/05/21:39:48
>I simply have several question in mind about compilation of C.
>
>When I do:
>int i;
>
>i=3+4;
>
>Does GCC generate i=7 or i=3+4 ?
>
>I suppose the answer is the same for
>i=0x01 | 0x02 which is equal to i=0x03
>
>Again, in:
>#define FIVE 3+2
>
>is it the same, for the compiled program as #define FIVE 5 ?
Well, the best way to check that kind of thing is to
1. for #define : Just preprocess, and look in a place where the symbol
has been replaced.
2. for other stuff : Compile to assembly language and check the
generated code.
With those 2 tricks, you will be able to know everything about what
the compiler does with your code :-)
Hope it helps.
--
Eric Nicolas <nicolas AT dsys DOT ceng DOT cea DOT fr>
Take a look to the SWORD home page :
http://mimine.iut.univ-metz.fr/~borysgr/sword.web/home.html
- Raw text -