Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: xsrc/external/mit/xauth/dist

On Sun, Jun 02, 2013 at 12:40:12AM +0000, Christos Zoulas wrote:
 > > > > Log Message:
 > > > > apply __UNCONST() if it exists.
 > > > 
 > > > Reminds me: should/can __UNCONST() be revisited w.r.t. the thread below?
 > > > 
 > > >
 > >
 > >How/why? Yes, it's unsafe. That's the *point*.
 > Well, there is an advantage that the FreeBSD one has over ours. It can be
 > used in c++ with -Wold-style-cast, if defined as:
 > #define      __DECONST(t, a) const_cast<t>(a)

and I suppose one could also do something like this:

#define __DECONST(t, v) \
   (sizeof((v) - (const t)0) ? (t)(unsigned long)(v) : 0)

to make it more or less typesafe at the cost of expanding the value
more than once. (And someone might be able to come up with a version
that doesn't require that.)

As for the unsigned long, we could just use uintptr_t and expect users
of the macro to include stdint.h themselves; after all it isn't
supposed to be used at all except in certain known special cases.

David A. Holland

Home | Main Index | Thread Index | Old Index