Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C and C++ macros are worse than textual.

They work with abstract token sequences.

This, per se, is not inherently worse, except that, oops: undefined behavior is worked into the spec. For instance, if you have a macro argument X which holds the ( token and another one Y which holds 123, and you paste these together using X ## Y, you get undefined behavior: two tokens are pasted to form something which is not a single, valid token.

A purely textual preprocessor wouldn't have an UB issue of this type.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: