arachnid@deimos arachnid$ cat > test.c
#define INFIN_REPEATS 123
#define CARDS (INFIN_REPEATS * 256)
int main() {
printf("%d\n", CARDS);
}
arachnid@deimos arachnid$ gcc -E test.c
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.c"
int main() {
printf("%d\n", (123 * 256));
}
Answer: No, but I'm betting the compiler will:
arachnid@deimos arachnid$ gcc -S test.c -o -
.file "test.c"
.section .rodata
.LC0:
.string "%d\n"
.text
.p2align 2,,3
.globl main
.type main, @function
main:
<...>
pushl $31488
<...>
.ident "GCC: (GNU) 3.4.2 [FreeBSD] 20040728"
And there you have it. The preprocessor won't, but even without optimisation settings, GCC will. |