[CentOS-devel] Hello, I have a program problem with C

taozhijiang taozhijiang at gmail.com
Tue Dec 10 14:06:46 UTC 2013


Hello, all:

I have a program problem, ( may it not have close releationship with 
CentOS), it described like this:


I want to using #define / #undef, and want to put them in a single 
macro, some thing like:

#define DECALRE_TYPE(type) \
{ #undef __curr_type;  #define _curr_type type; }

as we know, this can not passed with CPP, but I need this logical here.

Generally, the problem comes from

#define ser_field(type, var) \
     ser_new_field(tra, #type, #var, offsetof(struct_type, var))

I do not want another additional parameter in this macro like

#define ser_field(type,var,struct_type), and I want a sentence declare 
"current struct type"
and all later work of ser_field will defaultly use this type.

I am not sure whether I can express it clearly, any ideas will be 
greately appreciated!


Thanks and B.R.




More information about the CentOS-devel mailing list