This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/22485] pointer +- integer is never NULL
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jul 2005 14:43:13 -0000
- Subject: [Bug c/22485] pointer +- integer is never NULL
- References: <20050714131031.22485.mattias@virtutech.se>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From gdr at integrable-solutions dot net 2005-07-15 14:43 -------
Subject: Re: pointer +- integer is never NULL
"falk at debian dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| (In reply to comment #13)
| > Subject: Re: pointer +- integer is never NULL
| >
| > "falk at debian dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| > | Sorry, I cannot follow you. I'd find it massively unsurprising if
| > | reinterpret_cast<int*>(0) produces a null pointer, and if I then get
| > | undefined behavior for doing something with it that is undefined for a
| > | null pointer.
| >
| > But, if I used reinterpret_cast to turn an integer value 0 into a
| > pointer, there is no reason why the compiler would assume that I do not
| > know the underlying machine and what I'm doing with the pointer.
|
| The note merely requires the result of the mapping to be unsurprising;
| it does not say anything about further operations of this result. Therefore,
| it is completely irrelevant here.
The "side" notes were written by people who know what they
intend. Therefore their inputs are completely relevant here.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22485