3 ms·
yes, we need macros, more macros. Then it will be good. In all seriousness though, it's basically supposed to teach about function pointers. I would never, e
by cioc 14y ago
yes, we need macros, more macros. Then it will be good.
In all seriousness though, it's basically supposed to teach about function pointers.
I would never, ever recommend programming like this.
In response to the macros, i think that would make the program particularly hard to reason about because part of the program would be rewritten at compile time.
I would discourage the use of macros. I believe that Brian Kernighan would agree with me.
As a rule of thumb, it is better to use enums over #defines and avoid macros like death. Stick to the most standard, simple parts of the language and your programs will be most readable and likely elegant.
- thewarrior 14y agoI just said it because sooner or later someone is going to barge in and say "Hey whats the big deal here ? I did this way back in data structures 101 ! "
- mtdewcmu 14y ago>> "Avoid macros like death" Macros are arguably one of the most standard and simplest parts of C. They are much more dependable than, say, gcc inline functions (in my experience). Just don't try to do bizarre things with them. Study how the best C programmers use them, and imitate.
- userulluipeste 14y agoYou wanted to say "do not abuse macros" (like "do not go extreme with anything" actually). And BTW, you should know that death is unavoidable! :)