As for the updated question, by the use of auxiliary macro VA_ARGS like the following, the arguments will be expanded as expected.
Up vote 3 down vote favorite share g+ share fb share tw.
EDIT: Digging throug gcc docs I found that adding ## before VA_ARGS removes the , when there are no arguments but with that I can not nest macros, CALL(print,CALL(HeadSize)); this causes CALL not defined error how ever if I separate the the calls it works c++ c preprocessor link|improve this question edited May 5 '11 at 0:29 asked May 5 '11 at 0:01Hamza Yerlikaya10.6k84288 68% accept rate.
1 You can have CALL delegate to different macros depending on the number of arguments it is passed. I demonstrated how to do this in an answer to another question. This does not require any implementation-specific hacks.
– James McNellis May 5 '11 at 0:30 also see stackoverflow.com/questions/5588855/… – Richard Hansen Feb 9 at 3:26.
As for the updated question, by the use of auxiliary macro VA_ARGS like the following, the arguments will be expanded as expected. #define VA_ARGS(...) , ##__VA_ARGS__ #define CALL(f,...) FN(f)->call((ref(new LinkedList()) VA_ARGS(__VA_ARGS__))) Hope this helps.
If you are using GCC, it has an extension to swallow up the comma preceding the __VA_ARGS__. See: gcc.gnu.org/onlinedocs/cpp/Variadic-Macr....
Beat me by 11 seconds :) – mu is too short May 5 '11 at 0:27 Only because yours is more thorough. :) – Scott Moonen May 5 '11 at 0:28 And MSVC, even though not mentioned on their MSDN page, supports the same extension, making everybody's lives a little bit easier. – vanza May 5 '11 at 0:28.
If you're using gcc/g++ there is a way: #define CALL(f,...) FN(f)->call((ref(new LinkedList()), ## __VA_ARGS__)) From the fine manual: ... if the variable arguments are omitted or empty, the `##' operator causes the preprocessor to remove the comma before it. So gcc has an extension/hack specifically for the problem you are facing.
I have edited the question, I have found the same thing in the docs but with it I can not nest macros – Hamza Yerlikaya May 5 '11 at 0:30.
Unfortunately this cannot be done. You will need to define a separate macro to do this call. As you end up with invalid arguments when VA_ARGS is substituted with nothing you end up with a floating , #define CALL0(f) FN(f)->call((ref(new LinkedList()))).
Simply make f part of the ..., and use a separate macro to extract the first argument where you need f.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.