Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!novavax!proxftl!bill From: bill@proxftl.UUCP (T. William Wells) Newsgroups: comp.lang.c Subject: Re: Structure pointer question Summary: all struct ptrs are equivalent Message-ID: <389@proxftl.UUCP> Date: 29 Jun 88 03:23:12 GMT References: <361@teletron.uucp> <8074@brl-smoke.arpa> <4524@haddock.isc.com> <5925@aw.sei.cmu.edu> Organization: Proximity Technology, Ft. Lauderdale Lines: 30 Having reread the new C standard just to see what it says about incomplete types relating to structure pointers, here is what I come up with. There is nothing wrong with a source file like: struct { struct bar *ptr; } x; func() { void *vp; vp = (void *)x.ptr; vp = 0; } Nothing in the standard seems to require completing the type unless the pointer is actually dereferenced. Furthermore, since the assignments are valid (see 3.3.16.1), this implies that the compiler knows the internal representation of the structure pointer even if it does not know the contents of the structure. There are only two ways that I can think of to accomplish this: make all structure pointers equivalent or defer code generation till link time. I would be extremely surprised (read, "what reality are YOU in?") if they want to require the latter, so it must be the former. The C standard should make that explicit, don't you think?