This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: climits: unsafe #defines?


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

Attachment: libstdcxx-climits.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]