Language Redefinition with #define?

Frank Whaley frank at sagan.UUCP
Mon Sep 16 17:50:27 AEST 1985


In article <163 at unitek.uucp>, reid at unitek.uucp (Reid Spencer) responds:
> Hey, don't get so down on yourself. I'm in favour of what you have 
> suggested. How about the following:
> #define cycle for(;;) {
> #define endcycle }
> #define then {
> #define otherwise } else {
> #define elseif } else if 
> #define endif }
> #define exitwhen(exp) if (exp) break;
> #define exitunless(exp) if (!(exp)) break;
> We can then write
>   cycle
>       exitwhen(cond1)
>       if (cond2) then
>           stuff1
>       elseif (cond3) then
>           stuff2
>       otherwise
>          stuff3
>       endif
>   endcycle

[ FLAME ON ]
What language is this??  Surely not my old friend C.  I have encountered this
style of coding in the work of "professional" coders (note that I *did not*
use the word "programmer":-).  I found chasing the bugs to be similar to
learning PL/I -- I had to re-educate my fingers in order to be able to
manipulate these strange symbols.
I hope that this sort of #define abuse is not being taught in the nation's
educational establishments.  I currently work within a team of 16 programmers
who must be able to *understand*, not just read, each others work.  Sometimes
months pass between edits of a file.  I have found that mandating only the
barest minimum (K&R, Library Manual, the Mystical and Untouchable Header Files)
is all that will be accepted with any semblance of agreement.
I contend that (in a commercial environment) the #define command should only
be used for constant and macro definitions, and any further use falls into
the category of gratuitous tinkering.
[ FLAME OFF ]
On the other hand, I've used preprocessor #defines to prototype the syntax
of another language, before I learned to yacc.

-- 
frank
... Frank Whaley, MicroPro Product Development
{dual,hplabs,glacier,lll-crg}!well!micropro!sagan!frank



More information about the Comp.lang.c mailing list