Integer overflow...

Discussion in 'C Programming' started by amit.codename13@gmail.com, Jul 20, 2009.

  1. Guest

    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
    variable

    int i;
    i=9999999999999999999999;

    now the value on the right is converted to the type of left side as
    per the following rule...


    6.3.1.3
    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?
    , Jul 20, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bartek
    Replies:
    3
    Views:
    3,080
    bartek
    Feb 6, 2004
  2. John Black
    Replies:
    1
    Views:
    4,489
    John Harrison
    Apr 15, 2004
  3. deancoo

    integer or long overflow...

    deancoo, Mar 5, 2005, in forum: C++
    Replies:
    11
    Views:
    750
    Pete Becker
    Mar 5, 2005
  4. Enrico 'Trippo' Porreca

    Integer overflow

    Enrico 'Trippo' Porreca, Aug 21, 2003, in forum: C Programming
    Replies:
    9
    Views:
    400
  5. Ashutosh Iddya

    integer overflow

    Ashutosh Iddya, Apr 16, 2004, in forum: C Programming
    Replies:
    25
    Views:
    909
    RoSsIaCrIiLoIA
    Apr 24, 2004
Loading...

Share This Page