
2 Nov
2007
2 Nov
'07
11:03 p.m.
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.)