Subject: Re: __UNCONST(a)
To: None <christos@zoulas.com>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-userlevel
Date: 07/02/2004 10:06:21
> | > | > I would like to add:
> | > | > 
> | > | >     /* No intptr_t dependency here */
> | > | >     #define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
> | > | > 
> | > | > in <sys/cdefs.h>
> | > | > 
> | > | > Any objections?
> | > | 
> | > | FreeBSD has __DECONST.
> | > | please follow it unless there's a compelling reason.
> | > 
> | > Ok, DECONST it is...
> | 
> | i think that it's a bad idea to follow only its name while being imcompatible.
> | FreeBSD's is:
> | #define	__DECONST(type, var)	((type)(uintptr_t)(const void *)(var))
> 
> Why cast to a specific type? We could do the same, but it seems gratuitous.

because it's only sane way without typeof().

YAMAMOTO Takashi