9fans archive / 1997 / 03 / 13 /    prev

From: Scott Schwartz schwartz@gal...
Subject: fwd
Date: Wed, 26 Mar 1997 14:01:12 -0500

(This appeared on the newsgroup, but didn't make it to the mailing list.)

From: jm@pas... (Jean Mehat)
Subject: (bad) surprise with the C compiler
Summary: non-atomic operation on structures
Date: Sat, 22 Mar 1997 17:29:48 GMT
Organization: Institut Pasteur, Paris

I was somewhat surprised when I realised that
	delta = Pt(-delta.y, delta.x)
expanded as
	delta = (Point){-delta.y, delta.x}
was actually equivalent to
	delta.x = -delta.y, delta.y = delta.x
As you can suppose, it doesn't work as intended.
--
Jean Mehat, universite de Paris 8 Vincennes a Saint Denis,
jm@uni..., (33) 01 49 40 64 03, (33) 01 49 40 67 83 (fax)