Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 Unisoft-Cosmos; site sagan.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!qantel!dual!lll-crg!well!micropro!sagan!frank From: frank@sagan.UUCP (Frank Whaley) Newsgroups: net.lang.c Subject: Language Redefinition with #define? Message-ID: <137@sagan.UUCP> Date: Mon, 16-Sep-85 03:50:27 EDT Article-I.D.: sagan.137 Posted: Mon Sep 16 03:50:27 1985 Date-Received: Thu, 19-Sep-85 05:45:25 EDT References: <1370@brl-tgr.ARPA> <163@unitek.uucp> Organization: MicroPro Int'l Corp., San Rafael, CA Lines: 46 In article <163@unitek.uucp>, reid@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