Bug in indent.

Ian Donaldson iand at labtam.oz
Wed Jul 25 11:25:17 AEST 1990


dcw at doc.ic.ac.uk (Duncan C White) writes:


>Greetings,
>	On examination, this is because the x=!x line has been rewritten as:

>		x != x;

This sounds like the old C syntax problem that most C compilers *warn*
about still.  ie:

		x=-3;

used to mean
		x -= 3;


whereas if you really wanted -3 assigned to x you were supposed to
put extra spaces in:

		x = -3;

eg: if you compile this with SVR3.2.1 C compiler you get no warnings:

	main()
	{
		int x;

		x=-3;
		(void) printf("%d\n", x);
		return(0);
	}

and running it prints '-3', but if you run SVR3.2.1 lint over the code
you see:
    (5)  warning: ambiguous assignment: simple assign, unary op assumed

So it looks like the compiler is forgiving but lint still knows the old
way things were done.  I remember older compilers complaining about
such syntax too.

Maybe the =! case is similar.  Maybe indent should warn about it
if it does a conversion.

Ian D



More information about the Comp.bugs.4bsd.ucb-fixes mailing list