bug with indent

Mark J. Kilgard mjk at fluffy.rice.edu
Sat Jun 3 15:07:12 AEST 1989


The following bug with indent has come to my attention.  Constructs like
=* and =& and such get confused  and actually get switched to avoid
anachronisms!

Example:

main()  /* compiles without errors */
{
   int a=1;
   int* b; 
   int c; 

   b=&a; 
   c=*b; 
} 

after indent -npro

main()
{
        int             a = 1;
        int            *b;
        int             c;

        b &= a;
        c *= b;
}

error messages from cc:

"foo.c", line 8: operands of &= have incompatible types
"foo.c", line 9: operands of *= have incompatible types

(I'm in SunOS 4.0 land.  But I assume the bug is in 3.5 too.  The compiler
will probably give different messages.  It's probably a BSD bug.  Maybe
well know but this is the first time I've encountered it.)

This is very annoying.  It basically breaks your code that should work.
The work around is to simply better space your code if you plan to run it
through indent.

I appreciate moving away from anachronisms and all but not if my code
breaks.

- Mark



More information about the Comp.sys.sun mailing list