stringification Questions

5

Solved

I want to comment a line using the pre-processor: #define open /##* #define close */ main() { open commented line close } when I do $gcc -E filename.c I expected /* commented line */ bu...
Naturalistic asked 6/3, 2010 at 7:35

3

Solved

I'm trying to do something that is conceptually similar to this, but can't seem to get it to work (error shown at end) any ideas? #include <stdio.h> int main( int argc , char const *argv[] ...
Higgler asked 20/11, 2009 at 1:1

4

Solved

I have a C program below: #define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); } when I run just the preprocessor it expands this as { int var12=100; printf("%d",var12); } w...
Ballot asked 8/1, 2010 at 6:17

4

Solved

what I'd like to do (for logging purposes) is something like this: This code has been written to show my problem, actual code is complex and yes, I have good reasons to use macros even on C++ =) ...
Tent asked 10/12, 2009 at 13:3

7

Solved

What is a##b & #a? #define f(a,b) a##b #define g(a) #a #define h(a) g(a) main() { printf("%s\n",h(f(1,2))); //how should I interpret this?? [line 1] printf("%s\n",g(f(1,2))); //and thi...
View asked 6/11, 2009 at 9:0

3

Solved

I'm having a macro like this ( not exactly, but function is quite equivalent): #define STRUCTMEMBER(Member,Value) GlobalStructInstance. ## Member = Value ... STRUCTMEMBER(Item,1); This works per...
Celadon asked 30/7, 2009 at 13:30

7

Solved

Alternative titles (to aid search) Convert a preprocessor token to a string How can I make a char string from a C macro's value? Original Question I would like to use C #define to build literal...
Assembler asked 28/4, 2009 at 14:21

25

Solved

In our legacy code, as well as our modern code, we use macros to perform nifty solutions like code generations, etc. And we make use of both the # and ## operators. I am curious how other d...
Mayday asked 16/3, 2009 at 13:42

© 2022 - 2024 — McMap. All rights reserved.