Please help a macro beginner... I created a simple macro for loading images and split it up into several lines so that I can log every time code generated from the macro is executed (for debugging). It looks like this:
#define LOAD_PNG(L_I_IMAGE_NAME) ({ \
PngImageClass* __tmp; \
printf("Loading png: %s", L_I_IMAGE_NAME);\
__tmp = [image loading code here];\
__tmp; \
})
My plan was to be able to easily comment out the log line (manually) when needed, but the pre-processor won't tolerate any of the normal ways. How should it be done?!
EDIT: I was completely wrong in saying it doesn't work "any of the normal ways" since I had been lazy enough to only try the single line comment. I'll also heed the advice from several responders to turn this into a function. No, there's no good reason (I guess) to use a macro for this.