Subject: Re: __UNCONST(a)
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Greg A. Woods <woods@weird.com>
List: tech-userlevel
Date: 07/01/2004 17:39:07
[ On Thursday, July 1, 2004 at 04:58:22 (-0400), der Mouse wrote: ]
> Subject: Re: __UNCONST(a)
>
> > > #define __UNCONST(a) ((void *)(((const char *)(a) - (const char *)0) + (char *)0))
> >
> > Although this will likely work on most (if not all) architechtures,
> > it's not really allowed by C. When subtracting pointers they both
> > have to point into the same array.
Indeed.
> Isn't it into the same _object_?
How can a NULL pointer ever point to the same storage object as any
other non-NULL pointer?
(never mind that conceptually a nil pointer doesn't point at any storage
object :-)
--
Greg A. Woods
+1 416 218-0098 VE3TCP RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com> Secrets of the Weird <woods@weird.com>