Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-11-02 19:03:10


Boris Gubenko:

>> I think the correct change to silence the type conversion error is
>>
>> char * first = static_cast<char *>(static_cast<void
>> *>(const_cast<long*>(&
>> l)));
>
> I'm not sure my change is incorrect. In terms of style, I think that your
> change is better.

Dave's insistence that we have to obfuscate our reinterpret_casts is well
known and a very strict reading of the standard is on his side _in this
specific case_, but I personally don't find his style better at all.

(A reinterpret_cast<char*>( p ) is indirectly required to work when p is a
pointer to a class type, but it's possible in theory for a sufficiently
mischievous compiler to break it for long*. I know of no such compiler,
present or future, of course.)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk