3 ms·
Cute. There's actually a much more pedestrian point hidden in there, which is that cpp really is an extraordinarily expressive (if hideously clunky) environmen
by ajross 18y ago
Cute. There's actually a much more pedestrian point hidden in there, which is that cpp really is an extraordinarily expressive (if hideously clunky) environment, and you can do all sorts of good things with macros if you're willing to learn the tricks.
It's really sad that a bunch of people who never did learn the tricks ended up declaring macros as "bad" by fiat, to the extent that newer languages have had to invent less expressive versions (C++) or omit the facility entirely (Java). These days, it's almost a lost art.
- swolchok 18y agoWell, cpp isn't Turing complete, assuming you only run it once: http://www.ioccc.org/2001/herrmann1.hint http://www.ioccc.org/2001/herrmann1.hint
- eru 18y agoAnd C++'s templates are Lambda-Calculus isomorph. (I.e. Turing complete for you imperative programmers. ;o)
- russell 18y agoActually, it was a bunch of people who thought that the rest of us were not competent enough to use them without shooting ourselves in the foot, head, or other parts of our anatomy. (James Gosling are you listening?) I used macros to great effect to create constant data structures for such things as keyword tables in parsers. The art of programming has advanced a long ways since the early days of C. I think the badness of macros is more a function of those times than inherent problems with macros themselves.
- burke 18y ago"...without shooting ourselves in the foot, head, or other parts of our anatomy." I hear macros are useful for shooting yourself in the gun.
- deleted 18y ago[deleted]
- jmillikin 18y agoCPP can be used with Java, since it's completely independent of the "real" underlying language. There's also several native Java preprocessors available.