From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2431 invoked by alias); 8 Jun 2008 16:37:36 -0000 Received: (qmail 2422 invoked by uid 22791); 8 Jun 2008 16:37:36 -0000 X-Spam-Check-By: sourceware.org Received: from mu-out-0910.google.com (HELO mu-out-0910.google.com) (209.85.134.189) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 08 Jun 2008 16:37:09 +0000 Received: by mu-out-0910.google.com with SMTP id i2so1217385mue.6 for ; Sun, 08 Jun 2008 09:37:07 -0700 (PDT) Received: by 10.103.248.17 with SMTP id a17mr1667911mus.63.1212943026914; Sun, 08 Jun 2008 09:37:06 -0700 (PDT) Received: from shadow ( [89.102.207.196]) by mx.google.com with ESMTPS id j10sm13907791muh.18.2008.06.08.09.37.05 (version=SSLv3 cipher=RC4-MD5); Sun, 08 Jun 2008 09:37:05 -0700 (PDT) From: Denys Vlasenko To: gcc@gcc.gnu.org Subject: climits: unsafe #defines? Date: Sun, 08 Jun 2008 16:37:00 -0000 User-Agent: KMail/1.8.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200806081833.02377.vda.linux@googlemail.com> X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2008-06/txt/msg00184.txt.bz2 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