Path: utzoo!attcan!uunet!husc6!think!ames!ncar!gatech!mcnc!rti!xyzzy!throopw
From: throopw@xyzzy.UUCP (Wayne A. Throop)
Newsgroups: comp.lang.c
Subject: Re: Structure pointer question
Message-ID: <921@xyzzy.UUCP>
Date: 19 Jun 88 18:25:39 GMT
References: <361@teletron.uucp> <8074@brl-smoke.arpa> <4524@haddock.isc.com>  <4606@haddock.ISC.COM> <5925@aw.sei.cmu.edu>
Organization: Data General, RTP NC.
Lines: 32

> firth@sei.cmu.edu (Robert Firth)
>> karl@haddock.ima.isc.com (Karl Heuer)
>>Although pointer-to-char and
>>pointer-to-int might have different internal representations, pointer-to-
>>-struct-foo and pointer-to-struct-bar cannot%.
> This makes no sense to me.  Surely a pointer to a struct whose only
> component is of type X will use the same representation as a pointer
> to a plain X.  Hence if *X and *Y differ, so will *struct{X} and
> *struct{Y}.

Actually, I think you're both wrong.  Sort of.

First, a pointer to a struct containing only a char and a pointer to a
char needn't have the same format to be standard conforming.  In fact,
DG's C compiler does this very thing: pointer-to-char and
pointer-to-struct-containing-only-a-char have different formats.  

But on the other hand, I'm not aware of any requirement in draft X3J11
that all struct pointers have the same format.  It is a good idea to
make it so, because of quite a bit of existing code, and so many
compilers do, indeed, make it so.  But they needn't, as far as I know.

In a footnote in Karl's posting, he said that he thought he could
construct an argument that draft X3J11 does indeed require this.  I'd be
interested to see this argument... As I said, I don't see how it could
be constructed.  But, as always, I could be missing some fine print.

--
"You don't think my theory holds water?"
"A bathtub will hold water.  A canteen is usually sufficent."
        --- exchange between Laurent Michaelmas and Domino
-- 
Wayne Throop      !mcnc!rti!xyzzy!throopw