8 bytes into 2 bytes fits ?
Alexandre Oliva
oliva@dcc.unicamp.br
Tue Sep 8 23:54:00 GMT 1998
David C Binderman <dcb@pncl.co.uk> writes:
> At 10:31 PM 9/2/98 -0300, you wrote:
>> David C Binderman <dcb@pncl.co.uk> writes:
>>
>>> surely pointers can only be cast to types big enough to hold them.
>>
>> Casting a pointer (but not a pointer to member) to any integral type
>> has always been allowed.
> Not in my experience of C++.
You've got good experience, indeed. :-)
[expr.reinterpret.cast]/4 says that a pointer can be explicitly
converted to any integral type *large enough to hold it*. And I'm
happy I can't find any other kind of cast that would allow such a
lossy conversion. Looks like the C++ standard fixed this C problem.
Or wasn't that allowed not even in C?
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
More information about the Gcc-bugs
mailing list