When do you use "if ( a = b )"? (was Re: Funny mistake)

Blair P. Houghton bhoughto at nevin.intel.com
Thu Apr 4 14:58:49 AEST 1991


In article <6773:Apr116:28:2991 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>I believe the original post contained a phrase like ``upon overflow.''
>Nothing's guaranteed for ints upon overflow. I'm not sure if your CPU is
>allowed to explode, but you're allowed to get weird results.

No bet when "the behavior is undefined."

And to answer Chris' question, if the type of the two things
is unsigned, there can be no overflow (underflow) (I'm 2.83
miles from my copy or I'd quote you chapter and verse,
of course), so they couldn't be unsigned and behave in an
undefined manner.

				--Blair
				  "It's best to be precise, though
				   that doesn't imply accurate..."



More information about the Comp.lang.c mailing list