climits: unsafe #defines?
Jonathan Wakely
jwakely.gcc@gmail.com
Sat Jun 21 13:22:00 GMT 2008
2008/6/8 Denys Vlasenko:
> Accudentally noticed this in my freshly built 4.3.1 tree
> in climits C++ header file:
>
> #ifndef LLONG_MIN
> #define LLONG_MIN -__LONG_LONG_MAX__ - 1
> #endif
>
> #ifndef LLONG_MAX
> #define LLONG_MAX __LONG_LONG_MAX__
> #endif
>
> #ifndef ULLONG_MAX
> #define ULLONG_MAX __LONG_LONG_MAX__ * 2ULL + 1
> #endif
>
>
> Think what will happen in this code: if (n < ULLONG_MAX / 20)...
Moved to the libstdc++ mailing list.
Is there any reason not to apply this patch to mainline?
* include/c_global/climits, include/tr1/climits: Add parentheses.
tested linux/x86_64
Jonathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libstdcxx-climits.patch
Type: application/octet-stream
Size: 1664 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20080621/c4772867/attachment.obj>
More information about the Libstdc++
mailing list