This is the mail archive of the
mailing list for the GCC project.
RE: signed vs unsigned pointer warning
- From: "Dave Korn" <dk at artimi dot com>
- To: "'Andreas Schwab'" <schwab at suse dot de>
- Cc: "'Morten Welinder'" <terra at gnome dot org>,<gcc at gcc dot gnu dot org>
- Date: Thu, 23 Sep 2004 12:35:22 +0100
- Subject: RE: signed vs unsigned pointer warning
> -----Original Message-----
> From: Andreas Schwab
> Sent: 22 September 2004 22:57
> To: Dave Korn
> Cc: 'Morten Welinder'; gcc
> Subject: Re: signed vs unsigned pointer warning
> "Dave Korn" writes:
> > Which I don't think you can, since you can't store negative numbers
> > in an unsigned type.
> Actually you can, due to the modulo behaviour of unsigned integers.
Well, yes, it is physically possible, but it's a kind of type-punning, it
defies the aliasing rules, and we get into some very deeply
language-lawyerly issues here, but it's not a valid representation IIUIC and
therefore invokes undefined behaviour in many circumstances.
Can't think of a witty .sigline today....