From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16016 invoked by alias); 24 Aug 2004 10:54:05 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 15924 invoked from network); 24 Aug 2004 10:54:03 -0000 Received: from unknown (HELO mx5.informatik.uni-tuebingen.de) (134.2.12.32) by sourceware.org with SMTP; 24 Aug 2004 10:54:03 -0000 Received: from localhost (loopback [127.0.0.1]) by mx5.informatik.uni-tuebingen.de (Postfix) with ESMTP id 6143B113; Tue, 24 Aug 2004 12:54:02 +0200 (MST) Received: from mx5.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx5 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 34352-02; Tue, 24 Aug 2004 12:54:00 +0200 (DFT) Received: from juist (semeai.Informatik.Uni-Tuebingen.De [134.2.15.66]) by mx5.informatik.uni-tuebingen.de (Postfix) with ESMTP id EC4ED10E; Tue, 24 Aug 2004 12:53:59 +0200 (MST) Received: from falk by juist with local (Exim 4.34) id 1BzYwB-0000NZ-MY; Tue, 24 Aug 2004 12:53:59 +0200 To: Eljay Love-Jensen Cc: gcc-help@gcc.gnu.org Subject: Re: g++ and null pointers References: <6.1.2.0.2.20040824053102.01e9b890@iplan-mn.corp.adobe.com> From: Falk Hueffner Date: Tue, 24 Aug 2004 17:18:00 -0000 In-Reply-To: <6.1.2.0.2.20040824053102.01e9b890@iplan-mn.corp.adobe.com> (Eljay Love-Jensen's message of "Tue, 24 Aug 2004 05:47:46 -0500") Message-ID: <87eklwajso.fsf@informatik.uni-tuebingen.de> User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (cabbage, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new (McAfee AntiVirus) at informatik.uni-tuebingen.de X-SW-Source: 2004-08/txt/msg00221.txt.bz2 Eljay Love-Jensen writes: > When I compile this test.cpp source... > > // g++ -Wno-long-long -pedantic -Wall -W -c test.cpp > #define NULL __null > int main() > { > void* p; > p = 0; > p = 0u; > p = 0ul; > p = 0ull; > p = 0l; > p = 0ll; > p = false; > // silly... > p = -0; > p = -0u; > p = -0ul; > p = -0ull; > p = -0l; > p = -0ll; > p = -false; > // my druthers... > p = NULL; > return 0; > } > > ...GCC is happy with all of these assignments. > > Are they all supposed (ISO 14882) to be legit? Some of them surprised me. The standard says that a null pointer constant is "[a]n integer constant expression with the value 0", so these seem all OK. -- Falk