This is the mail archive of the 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]
Other format: [Raw text]

Re: does gcc support multiple sizes, or not?

DJ Delorie wrote:
>>> reinterpret_cast doesn't require that the intermediate form have the
>>> same bit pattern.
>> Exactly so.  However, all valid pointers must be handles, so unless the
>> 32-bit address space is "sparse", something will go wrong.

I didn't help things here by saying "handles"; I meant "handled".  Sorry!

> I would go so far as to say that it's defined (hence supported) if the
> intermediate form is at least as many bits as the other types.

I'm not sure if I understand.  In ISO C++, it would be fine for "char *"
to have more bits than all other pointers.  The standard says X* -> Y*
-> X* is value-preserving if Y has no stricter alignment than X.  Since
"char" has weak alignment requirements, Y can be "char".  Is that what
you mean?

In ISO C++, there's of course no notion of "char *far" or "char *near";
there's just "char *".  So, there's no way to directly map your intended
type system onto the conversion sequence above.  The spirit of the
standard would seem to be that "X* near" -> "X* far" -> "X* near" be
value-preserving, but to make no guarantees about "X* far" -> "X* near"
-> "X* far".

Mark Mitchell
(650) 331-3385 x713

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