From owner-freebsd-bugs@FreeBSD.ORG Wed Dec 26 21:10:01 2012 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 48138916 for ; Wed, 26 Dec 2012 21:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 2BCC58FC0C for ; Wed, 26 Dec 2012 21:10:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id qBQLA1P5076765 for ; Wed, 26 Dec 2012 21:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id qBQLA1C6076762; Wed, 26 Dec 2012 21:10:01 GMT (envelope-from gnats) Date: Wed, 26 Dec 2012 21:10:01 GMT Message-Id: <201212262110.qBQLA1C6076762@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "b.f." Subject: Re: misc/174549: UINT64_MAX missing in C++ Program X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: "b.f." List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Dec 2012 21:10:01 -0000 The following reply was made to PR misc/174549; it has been noted by GNATS. From: "b.f." To: bug-followup@freebsd.org, Robin Carey Cc: Subject: Re: misc/174549: UINT64_MAX missing in C++ Program Date: Wed, 26 Dec 2012 21:02:35 +0000 On 12/26/12, Robin Carey wrote: > Dear bf, > > I tried defining > > # define __STDC_LIMIT_MACROS > > before the inclusion (as you suggested), and it made no > difference - the error still occurs. > > > If you look at what gets included by , you will see that that > definition is made in > > > > anyway .... or that is what it looks like to me .... so it looks likes the > system makes that definition by > default (in which case there is no need to define it manually in the source > code). Only if you are compiling in C++11 mode (most compilers don't use this mode except when it is specifically requested, because it is so new, and is rarely fully supported). The is because the requirement that some of these standard C definitions be hidden from C++ code except when __STDC_LIMIT_MACROS and/or __STDC_CONSTANT_MACROS is/are defined was removed from the C11 standard, and an explicit note was added to the C++11 standard that the __STDC* macros are not to be considered when including , so some implementations have taken this as license to disregard them entirely in C++11 mode: http://svnweb.FreeBSD.org/base?view=revision&revision=227475 http://svnweb.FreeBSD.org/base?view=revision&revision=227478 I don't have a live system running FreeBSD 9*, but on -CURRENT a simple program like: #include #ifdef UINT64_MAX #error UINT64_MAX is defined #else #error UINT64_MAX isn't defined #endif int main(void) { return (0); } behaves as expected: # c++ -Wall -Wextra -std=c++98 -o t1 test1.cc test1.cc:6:2: error: UINT64_MAX isn't defined #error UINT64_MAX isn't defined ^ 1 error generated. ret 1 # c++ -Wall -Wextra -std=c++98 -D__STDC_LIMIT_MACROS -o t1 test1.cc test1.cc:4:2: error: UINT64_MAX is defined #error UINT64_MAX is defined ^ 1 error generated. ret 1 # c++ -Wall -Wextra -std=c++11 -o t1 test1.cc test1.cc:4:2: error: UINT64_MAX is defined #error UINT64_MAX is defined ^ 1 error generated. ret 1 Also, in 9.1, I see in src/sys/sys/stdint.h (installed as /usr/include/stdint.h): 35#include and in the machine-dependent headers -- for example, in src/sys/i386/include/_stdint.h , which is installed as /usr/include/machine/_stdint.h on i386(on -CURRENT there is one more remove, because some of the i386 and amd64 headers have been unified): 60#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) ... 82#define UINT64_MAX 0xffffffffffffffffULL So are you sure you haven't overlooked something? b.