Standard indentation?

David Geary dmg at ssc-vax.UUCP
Thu Dec 15 03:21:14 AEST 1988


In article <6580 at polyslo.CalPoly.EDU>, cquenel at polyslo.CalPoly.EDU (Chris (i = --i++;) Quenelle) writes:
> In article <641 at htsa.uucp> fransvo at htsa.UUCP (Frans van Otten) writes:
> >
> >#define then    /*  as white space; see below  */
> >
> >	if (a > 10)
> >	  then putchar('1');
> >	  else putchar('2');
> 
> Bravo!!    Me Too!!
> whenever the statements are blocks, I omit the then, though.
> I vote strongly for this.  The symmetry scans very easily for me.
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^
  For you maybe, but for someone else reading your code, maybe not.
One of the first things that students in my C class who are reformed
;-) Pascal programmers, want to do is this:

#define BEGIN  {
#define END    }

and a whole slew of other macros to make C look like pascal.  

  Let's say that Joe, Jim, Bob, and Phyllis are all programmers
working on a C project.  Joe used to program in BASIC [sic],
Bob, Pascal, Jim, Fortran, and Phyllis ALGOL.  So all of them
spend a day or two writing macros to make their C code look
like the language that their used to.

  Then one day, Jim needs to debug Bobs code.  He's not
debugging C, - he's debugging some wierd C/Pascal code, and
Jim doesn't know Pascal.

  The moral of the story is:

1)  When you write C code, you should try to make it as readable
    for others as for yourself.
2)  If you ever have to read (or - gasp - debug) someone else's
    REAL C code - you're in trouble, because you don't KNOW C -
    you know some weird C/(insert favorite language) dialect.
3)  One of the best ways to learn C is to read someone else's C
    code.  (Even better, port it to a different machine).  If
    you don't write "real" C, you'll have a hell of a time
    reading "real" C.

  If you want to program in C - then program in C, not psuedo-C.


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ David Geary, Boeing Aerospace,               ~ 
~ #define    Seattle     RAIN                  ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the Comp.lang.c mailing list