Talk About Network

Google





Programming > C - C++ Learning > Re: Back to Sch...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 5 Topic 4104 of 4400
Post > Topic >>

Re: Back to School with NoName: Lesson 2, Integer Range Checking

by Ulrich Eckhardt <doomster@[EMAIL PROTECTED] > Apr 14, 2008 at 07:55 AM

NoName wrote:
> typedef char int8;

Check CHAR_BITS before making such claims.

> Conclusions:
> 
> Underflow for int8 not detected, BAD
> Overflow for int8 not detected, BAD

Underflow or overflow of signed integers causes 'undefined behaviour',
i.e.
the standard doesn't make any requirements for it. Some compilers even use
this knowledge in order to optimise code.

>  vMinInt32 = 2147483648; // same as -2147483648, solves warning,
>       <- weakness in language.

Ahem, you really mean that x equals -x? You should look up the meaning of
suffixes like U or L to numeric literals.


BTW: if you actually have a question, you should state that.

Uli
 




 5 Posts in Topic:
Back to School with NoName: Lesson 2, Integer Range Checking
"NoName" <No  2008-04-12 03:30:03 
Re: Back to School with NoName: Lesson 2, Integer Range Checking
Ulrich Eckhardt <dooms  2008-04-14 07:55:30 
Re: Back to School with NoName: Lesson 2, Integer Range Checking
Richard Heathfield <rj  2008-04-14 07:02:34 
Re: Back to School with NoName: Lesson 2, Integer Range Checking
Ulrich Eckhardt <dooms  2008-04-15 23:05:50 
Re: Back to School with NoName: Lesson 2, Integer Range Checking
"TheDevil" <  2008-04-15 01:09:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 9:20:13 PST 2009.