chirsz
3 months ago
The behavior of C macros is actually described by a piece of pseudocode from Dave Prosser and it is not in the standard:
* https://www.spinellis.gr/blog/20060626/
* https://www.spinellis.gr/pubs/jrnl/2006-DDJ-Finessing/html/S...
* https://gcc.gnu.org/legacy-ml/gcc-prs/2001-q1/msg00495.html
camel-cdr
3 months ago
This is the best explanation I've seen so far:
user
3 months ago
krackers
3 months ago
This needs to be framed somewhere, very lucid explanation
viega
3 months ago
Wow, I'm not sure I've ever seen this (or if I did, it was 20 years ago).
And I was definitely looking around for this kind of history when I was searching around when writing. Perhaps my google skills have decayed... or google... or both!
Thanks very much.
Joker_vD
3 months ago
Honestly, it feels like something like this should have been put in the standard instead of all the English prose that ended in the section about the preprocessor expansion. Yeah, it's not pretty, but at least it requires way less skill in hermeneutics to understand correctly.
kragen
3 months ago
Thank you very much for providing these links!