When do you use "if ( a = b )"? (was Re: Funny mistake)

Michael Henning michi at ptcburp.ptcbu.oz.au
Thu Mar 28 16:14:51 AEST 1991


dmm at cfa.harvard.edu (David Meleedy) writes:


>is perfectly reasonable... in fact here is an example of some pascal type
>code in c:

>#include        <math.h>

>#define REAL            float
>#define BEGIN           {
>#define WHILE           while(

[ More stuff deleted ]

>#define PROGRAM         main()

>PROGRAM

>BEGIN
>                REAL    a,b,c,root1,root2,discriminant;

>        a GETS 1 ;
>        WHILE NOT ( a EQUALS 0 ) DO
>           BEGIN
>                WRITELN(" Quadratic Equation Solver.  What are a,b, and c? ");
>                WRITELN(" Enter 0 alone to exit program.");
>                READ( a );

[ More stuff deleted ]

>admittedly it's not perfect pascal, but it is certainly readable and
>understandable.


Most places I've worked for, writing code like that would have cost me
my job. Are you really serious about this ?  Are you really suggesting
that this is an improvement over writing the same thing without macros ?

Why don't you write it in Pascal in the first place if you want it to look
like it ?

						Michi.
-- 
      -m------- Michael Henning			+61 75 950255
    ---mmm----- Pyramid Technology		+61 75 522475 FAX
  -----mmmmm--- Research Park, Bond University	michi at ptcburp.ptcbu.oz.au
-------mmmmmmm- Gold Coast, Q 4229, AUSTRALIA	uunet!munnari!ptcburp.oz!michi



More information about the Comp.lang.c mailing list