Hi,
When going through the book "Expert C Programming Deep C Secrets, by Linden", I came across a section that showed me that our Rennes RFSW colleagues were not the pioneers to obfuscate C programs by the use of the C preprocessor or macros. I paste the relevant section below, it is an interesting read.
Writing the UNIX Version 7 shell (command interpreter) at Bell Labs in the late 1970's,
Steve Bourne decided to use the C preprocessor to make C a little more like Algol-68.
Earlier at Cambridge University in England, Steve had written an Algol-68 compiler, and
found it easier to debug code that had explicit "end statement" cues, such as if ... fi
or case ... esac. Steve thought it wasn't easy enough to tell by looking at a " }"
what it matches. Accordingly, he set up many preprocessor definitions (Refer to the attachment for an example of what were the macros)
The authors informed advice therefore is (emphasis is mine)
"The Bournegol C dialect actually inspired The
International Obfuscated C Code Competition, a
whimsical contest in which programmers try to outdo each other in inventing mysterious and
confusing programs (more about this competition later).
Macro use is best confined to naming literal constants, and providing shorthand for a few well-chosen
constructs. Define the macro name all in capitals so that, in use, it's instantly clear it's not a function
call. Shun any use of the C preprocessor that modifies the underlying language so that it's no longer C."
Regards,
Srinath A