Do you trust the "indent" program?

Doug McDonald mcdonald at aries.scs.uiuc.edu
Wed Jan 2 02:11:57 AEST 1991


***************************************************************************
I would have used e-mail, but I know that it is hopeless: the poster of
the following gave no "real" address, only the bogus one "lerman at stpstn.UUCP"
He should edit his sendmail program to use a real address, either UUCP-
style complete with !'s or internet style a at b.c.d.e. Or put
his real address in a signature line.
***************************************************************************

In article <5970 at stpstn.UUCP> lerman at stpstn.UUCP (Ken Lerman) writes:
>
>NO, I would not trust indent.  
Then you are deluded. Indent is probably more trustworthy than your
C compiler.
>
>Alternative 1:
>You could write a program (call it undent) which replaces each
>contiguous string of white space with a single blank character.  You
>could run it on my code before and after running indent and diff the
>results.  If they are the same, you are probably OK.
This is a sufficient but not necessary condition. Indent will not
in general pass this test.

>
>The one area of concern I'd have left is what is done with comments.
>In particular, some CPPs treat the zero length comment /**/ as a
>concatenation operator.

Not if they are compiling the C language they don't. The string
/**/ MUST be replaced by a single white space. Period. All pertinent
references (K&R first edition, K&R second edition, and the actual
ANSI standard) all agree 100% on this. If you so-called C compiler
does something else, it is terminally broken.

>Make sure that the undent program does NOT
>treat this as white space. 

It MUST treat it as white space!!! Because that is what it is.

Doug McDonald (mcdonald at aries.scs.uiuc.edu)



More information about the Comp.lang.c mailing list