This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warning for different pointer signedness
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Paul Schlie <schlie at comcast dot net>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>, <gcc at gcc dot gnu dot org>
- Date: 20 Dec 2004 22:21:38 +0100
- Subject: Re: Warning for different pointer signedness
- Organization: Integrable Solutions
- References: <BDECA48D.8502%schlie@comcast.net>
Paul Schlie <schlie@comcast.net> writes:
| > From: Andrew Pinski <pinskia@physics.uc.edu>
| > Wrong, wrong, wrong, the change only moved a warning from -pedantic
| > to always on, in fact some compilers reject the code as it is invalid c.
| >
| > -- Pinski
|
| Which seems odd given (signed xxx *) and (unsigned xxx *) will always be
| guaranteed to be pointers to the exact same size and aligned storage units;
Pointers-to-object comparaison make sense (from the relevant standards
point of view) only if they
(i) point into the same object; or
(ii) are (or one of them is) one-past-the-end of the same object; or
(iii) are (or one of them is) null.
You then realize that if the pointers are not of the same type or cannot be
implicitly converted to each other, then the comparison become
invalid.
-- Gaby