Re: Warn for certain integer overflows

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

 



Frank Mehnert wrote:

>  uint32_t bar;
>  uint64_t foo;
>  ...
>  foo = bar << 20;

[...]

>I think it would be a big help if gcc could warn in the 2nd case.

What if the overflow / truncation is intended? Consider re-ordering
bytes...

>What do you think? Or is such a warning already available? I'm

Usually I don't care about compiler warnings because I use (PC-) Lint.

Lint is much better suited to warn me, because I can control warnings.

Oliver



[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