Re: how to make gcc warn about arithmetic signed overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21 September 2013 17:46,  wrote:
> Is it possible for gcc to produce a
> warning in such situation?

If ab and bc are 'const' then G++ will warn:

o.cc: In function ‘int main()’:
o.cc:5:14: warning: integer overflow in expression [-Woverflow]
 int r = ab * bc;
              ^

The C compiler still doesn't warn though, due to different rules for
how constants are handled between C and C++.





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux