Subject: Re: __UNCONST(a)
To: None <tech-userlevel@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 07/01/2004 04:58:22
>> #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.
Isn't it into the same _object_?
> We can probably ignore this for now.
Goodness yes. There are so many far less portable things in the tree
that this is down in the noise. Consider, for example, the code in
libc (xprt_register, to be specific) that assumes memset(...,0,...) on
an array of pointers does something useful.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML email@example.com
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B