Help for this page

Select Code to Download


  1. or download this
    #include <limits.h>
    #include <stdio.h>
    ...
        lval = lval * -1; // this is okay with -fwrapv
        printf("wrap lval  %ld\n", lval);
    }
    
  2. or download this
    $ gcc -Wall -Wextra -Woverflow -fwrapv -fsanitize=undefined t.c -o t &
    +& ./t
    t.c: In function ‘main’:
    ...
     LONG_MAX  9223372036854775807
    -LONG_MAX -9223372036854775808
    wrap lval  9223372036854775807