B
bolega
Basically, I have spent a few hours experimenting and searching on the
comp.lang.c/c++
Let me use SQR for brevity and saving line
Here are progressively refined macros :
#define SQR(x) ((x)*(x))
#define SQR(x) ({typedef xtype=x; xtype xval=x; xval*xval}) // NOTE,
closure or {} inside () is a valid idea in C, and thus no return is
needed.
this macro is given in several posts like
http://groups.google.com/group/comp...5da6/e5fe657622e5595b?q="typedef+xtype"&pli=1
there is a problem with typedef
Bolega
comp.lang.c/c++
Let me use SQR for brevity and saving line
Here are progressively refined macros :
#define SQR(x) ((x)*(x))
#define SQR(x) ({typedef xtype=x; xtype xval=x; xval*xval}) // NOTE,
closure or {} inside () is a valid idea in C, and thus no return is
needed.
this macro is given in several posts like
http://groups.google.com/group/comp...5da6/e5fe657622e5595b?q="typedef+xtype"&pli=1
there is a problem with typedef
Bolega