This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: warning: `%y' yields only last 2 digits of year


On Tue, Mar 12, 2002 at 02:22:06PM -0800, Tom Lord wrote:
> A more common example that's recently been reported to me by a GCC
> user says:
> 
> 	cast to pointer from integer of different size
> 
> and that's apparently without even "-Wall".  The code in question
> is an _explicit_ cast: "x = (void *)y".

Yes.  And with vanishingly few exceptions, this is wrong.
In my experience you've probably got a program that won't
run on a 64-bit machine.  You probably meant to use size_t
instead of int or something.

For those cases where you really REALLY know what you are
doing, "x = (void *)(size_t)y" will not warn.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]