help fixing overflow warning with abs()...
help fixing overflow warning with abs()...
- Subject: help fixing overflow warning with abs()...
- From: "Sean McBride" <email@hidden>
- Date: Wed, 23 Dec 2009 10:36:49 -0500
- Organization: Rogue Research Inc.
Hi all,
This code:
int foo = ...;
if (abs(foo) >= 1)
generates this warning:
"warning: assuming signed overflow does not occur when assuming abs (x)
>= 0 is true [-Wstrict-overflow]"
How would you resolve this? Should abs() simply be avoided because of
the fact that abs(INT_MIN) returns INT_MIN?
Thanks,
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden