Would *you* get caught by this one?

G. Levine gal at atux01.UUCP
Wed Jan 25 01:43:11 AEST 1989


In article <1989Jan13.085902.2057 at LTH.Se>, newsuser at LTH.Se (LTH network news server) writes:
> In article <139 at mole-end.UUCP> mat at mole-end.UUCP (Mark A Terribile) writes:
> >	When is     a *= b      not the same as     a = a * b   ?
>
> For example, if you have:
>
> 	#define b x + y
>
> then:
>
> 	a *= b		<=> 	a *= (x + y)
> 	a = a * b	<=>	a = (a * x) + y

This is why its so important to use parentheses in a #define
statement.  Changing the define statement to

	#define b (x + y)

will save a lot ot headaches!

					gary

--------------------------------------------------------------------------------
If it wasn't so cool out today, it would be warmer.
--------------------------------------------------------------------------------



More information about the Comp.lang.c mailing list