From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1691 invoked by alias); 14 Jul 2005 21:47:17 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 1663 invoked by uid 22791); 14 Jul 2005 21:47:14 -0000 Received: from smtp08.web.de (HELO smtp08.web.de) (217.72.192.226) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 14 Jul 2005 21:47:14 +0000 Received: from [82.82.216.19] (helo=juist) by smtp08.web.de with asmtp (TLSv1:DES-CBC3-SHA:168) (WEB.DE 4.105 #297) id 1DtBXz-0004iI-00; Thu, 14 Jul 2005 23:47:11 +0200 Received: from falk by juist with local (Exim 4.52) id 1DtBXz-0006P0-97; Thu, 14 Jul 2005 23:47:11 +0200 To: Gabriel Dos Reis Cc: gcc-bugzilla@gcc.gnu.org, gcc-bugs@gcc.gnu.org Subject: Re: [Bug c/22485] pointer +- integer is never NULL References: <20050714131031.22485.mattias@virtutech.se> <20050714153701.29650.qmail@sourceware.org> From: Falk Hueffner Date: Thu, 14 Jul 2005 21:47:00 -0000 In-Reply-To: (Gabriel Dos Reis's message of "14 Jul 2005 21:37:29 +0200") Message-ID: <87wtntt600.fsf@debian.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (cilantro, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender: falk.hueffner@web.de X-SW-Source: 2005-07/txt/msg01839.txt.bz2 List-Id: Gabriel Dos Reis writes: > "falk at debian dot org" writes: > > | ------- Additional Comments From falk at debian dot org 2005-07-14 15:37 ------- > | (In reply to comment #7) > | > | > I'm failing to find anything in the C++ standard that suggests that the > | > following shall be undefined > | > > | > (reinterpret_cast(0) + 5) - 5 > | > | If (reinterpret_cast(0) + 5) - 5 is not undefined, then neither is > | reinterpret_cast(0) + 5. Then what is its result, by which paragraph > | in the standard? > > The standard says that the mapping used by reinterpret_cast to turn an > integer into a pointer is *implemented-defined*. It is not undefined. > GCC uses the "obvious" mapping, which is reinterpret_cast(0) is > the null pointer. So your example boils down further to the question of whether ((int*)0) + 5 is undefined, but you didn't answer my question yet. What is the result of ((int*)0) + 5, by which paragraph in the standard? -- Falk