This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 8 bytes into 2 bytes fits ?


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.  However, the mapping is implementation
defined and it may be lossy, just like in C.  It is even possible that
there isn't any integral type large enough to hold a pointer.
However, even in this case, the conversion (a reinterpret_cast) is
allowed.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]