c preprocessor expansion
Quoted 8 lines
#define FOO "bar"
int main() { printf(FOO); }
Quoted 6 lines
It will output this:
int main() { printf("bar"); }
gcc -E file.c
hofrat@rtl14:~/stuff$ cat file.c #define FOO "bar"
int main() {
printf(FOO);
}
hofrat@rtl14:~/stuff$ gcc -E file.c # 1 "file.c" # 1 "<built-in>" # 1 "<command line>" # 1 "file.c"
int main() {
printf("bar");
}
hofrat
Hi,
I was wondering if gcc has any argument which allows for the expansion of all macros in a file, just so if we have something like the following:
#define FOO "bar"
int main() {
printf(FOO);
}
It will output this:
int main() {
printf("bar");
}
Thanks,
TSFH
gcc -E would do this.
----- Original Message ----- From: "Task Struct From Hell" <[email protected]>
To: <[email protected]>
Sent: Thursday, January 08, 2009 9:49 AM
Subject: c preprocessor expansion
Quoted 19 lines
Hi,
I was wondering if gcc has any argument which allows for the expansion of all macros in a file, just so if we have something like the following:
#define FOO "bar"
int
main(){
printf(FOO);
}It will output this:
int
main(){
printf("bar");
}
Quoted 8 lines
Thanks,
TSFH
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
*** This email and any attachments thereto may contain private, confidential, and privileged material for the sole use of the intended recipient. Any review, copying, or distribution of this email (or any attachments thereto) by others is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto. ***
2009/1/8 Task Struct From Hell <[email protected]>:
Quoted 13 lines
Hi,
I was wondering if gcc has any argument which allows for the expansion of all macros in a file, just so if we have something like the following:
#define FOO "bar"
int
main(){
printf(FOO);
}
Quoted 6 lines
It will output this:
int
main(){
printf("bar");
}
gcc -E code.c -o codemacro.m
Signature · 1 line
noone is alone.
Quoted 14 lines · ninjaboy
2009/1/8 Task Struct From Hell <[email protected]>:
Quoted 13 lines
Hi,
I was wondering if gcc has any argument which allows for the expansion of all macros in a file, just so if we have something like the following:
#define FOO "bar"
int
main(){
printf(FOO);
}
Quoted 8 lines
Quoted 6 lines
It will output this:
int
main(){
printf("bar");
}gcc -E
code.c-o codemacro.m
Cheers for all responses so far!