public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: gcc-bugzilla@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org
Subject: Re: [Bug c/22485] pointer +- integer is never NULL
Date: Thu, 14 Jul 2005 19:38:00 -0000	[thread overview]
Message-ID: <m3mzopfabq.fsf@uniton.integrable-solutions.net> (raw)
In-Reply-To: <20050714153701.29650.qmail@sourceware.org>

"falk at debian dot org" <gcc-bugzilla@gcc.gnu.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<int*>(0) + 5) - 5
| 
| If (reinterpret_cast<int*>(0) + 5) - 5 is not undefined, then neither is
| reinterpret_cast<int*>(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<int*>(0) is
the null pointer.

-- Gaby


  reply	other threads:[~2005-07-14 19:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-14 13:10 [Bug c/22485] New: " mattias at virtutech dot se
2005-07-14 13:14 ` [Bug c/22485] " pinskia at gcc dot gnu dot org
2005-07-14 13:14 ` mattias at virtutech dot se
2005-07-14 13:19 ` falk at debian dot org
2005-07-14 13:45 ` dberlin at gcc dot gnu dot org
2005-07-14 13:46 ` falk at debian dot org
2005-07-14 15:19 ` gdr at integrable-solutions dot net
2005-07-14 15:21 ` gdr at integrable-solutions dot net
2005-07-14 16:03 ` falk at debian dot org
2005-07-14 19:38   ` Gabriel Dos Reis [this message]
2005-07-14 21:47     ` Falk Hueffner
2005-07-14 19:40 ` gdr at integrable-solutions dot net
2005-07-14 22:19 ` falk at debian dot org
2005-07-14 23:04 ` gdr at integrable-solutions dot net
2005-07-15  7:51 ` falk at debian dot org
2005-07-15  8:26 ` gdr at integrable-solutions dot net
2005-07-15  9:27 ` mattias at virtutech dot se
2005-07-15 10:35 ` gdr at integrable-solutions dot net
2005-07-15 11:42 ` pluto at agmk dot net
2005-07-15 14:25 ` falk at debian dot org
2005-07-15 15:02 ` gdr at integrable-solutions dot net
2005-07-15 15:21 ` falk at debian dot org
2005-07-15 15:54 ` mattias at virtutech dot se
2005-09-24  5:37 ` gdr at gcc dot gnu dot org
2005-09-24  9:39 ` falk at debian dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3mzopfabq.fsf@uniton.integrable-solutions.net \
    --to=gdr@integrable-solutions.net \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-bugzilla@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).