I'm learning C++ on my own with Practical C++ Programming by Steve Oualline. Pretty good book, but some of the exercises are vague to say the least. I've made it pretty far but the chapter on the preprocessor has proven a real nightmare, so I figure I'd ask for help here.
Exercise 10-1 for example, is "Create a set of macros to define a type called RETURN_STATUS and the following values: RETURN_SUCCESS, RETURN_WARNING, and RETURN_ERROR. Define a macro, CHECK_RETURN_FATAL,,, (sic) that takes a RETURN_STATUS as its argument and returns true if you have a fatal error."
I guess that the person I really should ask is Steve Oualline, but I figure even if I could get in touch with him he has probably forgotten what he meant in the five years since the last edition was published. =)
Anyway, ignoring the fact that I'm not sure I have understood the exercise, my solution would be the preprocessor equivalent ofBut how do I do that? I can't really do conditional logic from within a macro, right?Code:
if (input == RETURN_ERROR) return true;
Thanks in advance for any help you can offer!