(This is a contrived example)
With the following preprocessor lines:
#define SIZEOF_mytype 4
#define hton4b htonl
#define OUT(TYPE, VAR) \
OUT1(SIZEOF_ ## TYPE, VAR)
#define OUT1(SIZE, VAR) \
hton ## SIZE ## b(VAR)
I type:
OUT(mytype, t)
and want to get:
htonl(t)
but actually get:
htonSIZEOF_mytypeb(t)
I tried various intermediate macros to catenate SIZEOF_ and TYPE to try
get it to convert to 4 but the closest I have gotten is:
hton 4 b(t)
Whats the trick?
Thanks.