4 Jan
2012
4 Jan
'12
3:42 a.m.
From: Joerg Arndt <arndt@jjj.de>
These (branch-avoiding) techniques are "well known", see (fxtbook) section 1.11 "Avoiding branches", pp.15ff where a warning of the form "Your compiler may be smarter than you thought" is given.
Shouldn't the warning be more Nuddsian? In C, such expressions are either unnecessary or UB, pure and simple. Your compiler doesn't have to show smart behaviour at all - it may kill your cat if it wants to. Phil (with comp.{lang,std}.c hat on)