Why does gcc make "!(T_MAX+T_MAX+2)" equal to 0?

0

For gcc 9.3.0, when I try to print it as

int x = 0x7fffffff;
printf("%d", !(x+x+1+1));

it gives me 0. But when I try to print it as

int temp = (x+x+1+1);
temp = !temp;
printf("%d", temp);

it gives me 1 as expected. What happens?

c
gcc
asked on Stack Overflow Aug 4, 2020 by Zeyu Wang

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0