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: PR 6212

--On Wednesday, May 08, 2002 10:34:00 AM -0400 Robert Dewar 
<> wrote:

>> The type of a pointer is -- in your average type system -- purely
>> dependent on the type pointed to by the pointer.  To say it points to
>> one kind of type, but another kind of object, is to have substantially
>> enrichened your type system in a way that is not clearly beneficial.
> I think you mean something like "representation of a pointer and allowable
> operations". Obviously the statement you gave is not true in any language
> with name equivalence of types. For example in Ada
>    type A is access Integer;
>    type B is access Integer;
> describe two quite different types (and indeed in Ada you cannot even
> assign one to the other, since these might be separate storage pools).
> Even if you force interconvertability
>    type A is access all Integer;
>    type B is access all Integer;
> they are still quite different types.

Right.  Ada gives you finer control over some of these situations; in
C/C++ "typedefs" do not create new types; they create new names for old

The point is that a minimal constraint on many type systems is that two
things with the same type support the same operations.  (Note that this
doesn't talk about representation at all; if your language doesn't have
assignment-by-smushing-bits, representation may not matter.)  If you want
to draw finer bondaries than that, you can of course do that.  In C/C++,
representation matters greatly, so that becomes a finer distinction.  We
also don't treat "int" and "long" as the same type, even if they have the
exact same representation.  These GCC attributes essentially create new
types like "strangely-aligned, weirdly sized int" and that thing is only
a  little bit more like an int than a short is like an int.

Mark Mitchell         
CodeSourcery, LLC     

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