Xref: utzoo comp.lang.c:15501 comp.lang.c++:2423 Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!cornell!uw-beaver!microsoft!tonyw From: tonyw@microsoft.UUCP (Tony Williams) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: Would *you* get caught by this one? Keywords: Assignops Message-ID: <260@microsoft.UUCP> Date: 13 Jan 89 20:09:58 GMT References: <139@mole-end.UUCP> Reply-To: tonyw@microsoft.UUCP (Tony Williams) Organization: Microsoft Corp., Redmond WA Lines: 18 In article <139@mole-end.UUCP> mat@mole-end.UUCP (Mark A Terribile) writes: >Here's a simple C question on a point that caught me recently. Would *you* >get caught? > > When is a *= b not the same as a = a * b ? I think the proper answer is when your C compiler has a bug :-) More seriously, here is one that not many C compilers get right: int a = 2; a *= 0.5; Most compilers give you a == 0 following the *= statement, and a == 1 following a statment a = a * 0.5; (Thanks to Jeff Smith at Warwick, UK for pointing this one out to me) Tony Williams