[comp.sys.sun] bug with indent

mjk@fluffy.rice.edu (Mark J. Kilgard) (06/03/89)

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

rsalz@bbn.com (Rich Salz) (06/20/89)

Go to your nearest comp.sources.unix archie site and pick up the source
to indent that appeared in volume18...  It has this, and other bugs,
fixed.  Ozan Yigit did a lot of work clearing all the copyrights with
everyone who ever touched the code:  it's a superset of what's appeared
elsewhere.
	/rich $alz
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.