This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
climits: unsafe #defines?
- From: Denys Vlasenko <vda dot linux at googlemail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 8 Jun 2008 18:33:02 +0200
- Subject: climits: unsafe #defines?
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)...
--
vda