🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4376

Re: "Size not needed?"

#4376
From: Lawrence Kirby
Date: Fri, 17 Nov 1995 21:07
34 lines
1618 bytes
In article <48gu0r$91o@news0.rain.rg.net> plong@perf.com "Paul Long" writes:

>What does "the size...is not needed" mean? "Needed" sounds awfully vague. For
>example, is the size needed here?

I think it is clear enough that size is needed in contexts that require
an object type and not needed in contexts that allow an incomplete type
(since the distinction between object/incomplete types is exactly
whether the size of the type is known).

>
>   struct S x;
>   void foo() { x; }
>
>I don't think so, but perhaps this is implementation-dependent.

struct S x is the definition of an object x and requires an object type so
size is needed. This would have been OK with extern struct S x; or if struct S
had been completed by an earlier or later declaration of it.

>How about this one:
>
>   void bar(struct T x) { x; }
>
>Is this a conforming program? Is a diagnostic required?

Functions parameters are defined to be lvalues and hence objects - they must
have an object type.

-- 
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
Technical Details
Message-ID: <816642464snz@genesis.demon.co.uk>
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!genesis.demon.co.uk
References: <48gu0r$91o@news0.rain.rg.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!genesis.demon.co.uk
From: Lawrence Kirby <fred@genesis.demon.co.uk>
Newsgroups: comp.std.c
Subject: Re: "Size not needed?"
Date: Fri, 17 Nov 95 21:07:44 GMT
Organization: none
Message-ID: <816642464snz@genesis.demon.co.uk>
References: <48gu0r$91o@news0.rain.rg.net>
Reply-To: fred@genesis.demon.co.uk
X-NNTP-Posting-Host: genesis.demon.co.uk
X-Newsreader: Demon Internet Simple News v1.27