Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Integer overflow...

Thread Tools

Integer overflow...
Posts: n/a
Integer overflow...
The standard states integer overflow leads to undefined behavior...

I was trying to figure out why would any such overflow happen...

The standard way to modify a variable's value would be to use
assignment operators or unary operators like ++,--

consider, we are trying to store a large value in a integer type

int i;

now the value on the right is converted to the type of left side as
per the following rule...
Otherwise, the new type is signed and the value cannot be represented
in it; either the
result is implementation-defined or an implementation-defined signal
is raised.

so why would it lead to undefined behavior?
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add an Integer to another Integer? Sebastian Stelzer Java 6 04-07-2010 07:03 PM
CType(x,Integer) vs. Integer.Parse(x) =?Utf-8?B?Sm9l?= ASP .Net 7 02-07-2006 02:30 AM
how do I make Class.forName("Integer") returning java.lang.Integer? Johannes Zellner Java 22 12-19-2005 11:22 AM
How do I add an Integer to another Integer? Sebastian Stelzer Java 2 10-15-2004 01:17 PM
No Math.min(Integer, Integer)? =?ISO-8859-1?Q?Thomas_Gagn=E9?= Java 0 07-29-2003 07:46 PM