🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1782

Re: X3J11 Pleasanton meeting summary

#1782
From: Colin Plumb
Date: Thu, 04 Oct 1990 23:35
44 lines
1776 bytes
In article <470@taumet.com> steve@taumet.com (Stephen Clamage) writes:
> I believe the statement above attributed to Doug is not quite correct.
> The "struct foo x;" declaration uses an "incomplete type".
> Section 3.5.2.3 says that an incomplete type "may be used only when
> the size of an object of the specified type is not needed."
>
> So if you had
>	struct foo x;
>	size_t bar() { return sizeof(x); }
>	struct foo { int i; };
> this would violate the constraint, as would
>	struct foo x, y;
>	void bar() { x = y; }
>	struct foo { int i; };

I have to agree with Henry, though, in saying that "needed" is hoplessly
vague.  Given an incomplete type Foo, here are the things I can imagine
doing with it:

extern Foo variable;
Foo variable;
{ Foo variable; ... }
Foo function(...);
Foo function(...){...}
extern Foo variable[];
Foo variable[];
sizeof(Foo);

Which are legal?

And the follwoing produce a type Bar on which the question can be
asked recursively...

typedef Foo Bar;
typedef Foo *Bar;
typedef Foo Bar(...);
typedef Type Bar(Foo,...);
typedef Foo Bar[ELEMS];
typedef struct {... Foo x; ...} Bar;
typedef union {... Foo x; ...} Bar;

For which of these is the size needed?
-- 
	-Colin
Technical Details
Message-ID: <1990Oct4.233557.28571@watdragon.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!maytag!watdragon!spurge!ccplumb
References: <13996@smoke.BRL.MIL> <3206@mcrware.UUCP> <470@taumet.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!maytag!watdragon!spurge!ccplumb
From: ccplumb@spurge.uwaterloo.ca (Colin Plumb)
Subject: Re: X3J11 Pleasanton meeting summary
Message-ID: <1990Oct4.233557.28571@watdragon.waterloo.edu>
Keywords: X3J11 Pleasanton meeting C standard interpretations
Sender: daemon@watdragon.waterloo.edu (Owner of Many System Processes)
Organization: University of Waterloo
References: <13996@smoke.BRL.MIL> <3206@mcrware.UUCP> <470@taumet.com>
Date: Thu, 4 Oct 90 23:35:57 GMT
Lines: 44