Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 SMI; site unitek.uucp Path: utzoo!utcsri!ubc-vision!unitek!reid From: reid@unitek.uucp (Reid Spencer) Newsgroups: net.lang.c Subject: Re: C bites / programming style Message-ID: <163@unitek.uucp> Date: Wed, 11-Sep-85 18:17:23 EDT Article-I.D.: unitek.163 Posted: Wed Sep 11 18:17:23 1985 Date-Received: Thu, 12-Sep-85 08:50:28 EDT References: <1370@brl-tgr.ARPA> Reply-To: reid@unitek.UUCP (Reid Spencer) Organization: Unitek Technologies Corporation Lines: 57 Summary: In article <1370@brl-tgr.ARPA> DHowell.ES@XEROX.ARPA writes: >Personally, I don't really like the {} braces of C, nor the "begin..end" >of Pascal and its relatives. This is one thing that Ada has going for >it with its "if..then..endif" style. > >I like to use these definitions: > >#define IF if( >#define THEN ){ >#define ELSE }else{ >#define ENDIF } > >Then I can write > >... >IF condition THEN > statement_1 >ELSE > statement_2 >ENDIF >... > >Which I think is much cleaner than anything using braces or begin..end. >(Gee, I should write my own language) > >Dan > >Disclaimer: I'm having a hard time finding anyone who has my opinions >besides me. 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