Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Ike Naar <ike@iceland.freeshell.org> |
| Newsgroups | comp.std.c |
| Subject | Re: When is the complete type of an external definition known? |
| Date | Sun, 19 Aug 2012 21:56:49 +0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 32 |
| Message-ID | <slrn3vfsk32o91.221.ike@iceland.freeshell.org> (permalink) |
| References | <653592d3-2e3d-4252-baae-cf1da6fb18e9@googlegroups.com> <lnehn2lhgd.fsf@nuthaus.mib.org> <4c03f493-4606-4893-a3b6-291bd03152ff@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sun, 19 Aug 2012 21:56:49 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="9ba4c8ef6d067305a1d88d1cbd33e23d"; logging-data="14759"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MfJp/tVkaYjvoPmnObZCp" |
| User-Agent | slrn/0.9.9p1 (NetBSD) |
| Cancel-Lock | sha1:MXNAz4J3qev84I/hzZlB7xcQpuY= |
| Xref | csiph.com comp.std.c:1555 |
Show key headers only | View raw
On 2012-08-19, Vlad from Moscow <vlad.moscow@mail.ru> wrote:
>> Vlad from Moscow <vlad.moscow@mail.ru> writes:
>>
>> > Let consider a sample code
>> >
>> > #include <stdio.h>
>> > static int a[];
>> > int main( void )
>> > {
>> > printf( "sizeof( a ) = %ul\n", sizeof( a ) );
>> > return 0;
>> > }
>> > extern int a[10];
>>
>> > Shall a compiler issue an error for this sample code? Or the composite
>> > type of the array 'a' shall be known already in the point where the
>> > printf is used?
>
> According to paragraph 2 of section 6.9.2 External object definitions
> "If a translation unit contains one or more tentative definitions
> for an identifier, and the translation unit contains no external
> definition for that identifier, then the behavior is exactly as if
> the translation unit contains a file scope declaration of that
> identifier, with the composite type as of the end of the translation
> unit, with an initializer > equal to 0."
static int a[];
violates 6.9.2 p3:
"If the declaration of an identifier for an object is a tentative
definition and has internal linkage, the declared type shall not be
an incomplete type."
Back to comp.std.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
When is the complete type of an external definition known? Vlad from Moscow <vlad.moscow@mail.ru> - 2012-08-19 13:40 -0700
Re: When is the complete type of an external definition known? Keith Thompson <kst-u@mib.org> - 2012-08-19 14:06 -0700
Re: When is the complete type of an external definition known? Vlad from Moscow <vlad.moscow@mail.ru> - 2012-08-19 14:30 -0700
Re: When is the complete type of an external definition known? Ike Naar <ike@iceland.freeshell.org> - 2012-08-19 21:56 +0000
Re: When is the complete type of an external definition known? Vlad from Moscow <vlad.moscow@mail.ru> - 2012-08-19 16:42 -0700
Re: When is the complete type of an external definition known? Keith Thompson <kst-u@mib.org> - 2012-08-19 19:22 -0700
Re: When is the complete type of an external definition known? Wojtek Lerch <wojtek_l@yahoo.ca> - 2012-08-20 10:57 -0400
Re: When is the complete type of an external definition known? Keith Thompson <kst-u@mib.org> - 2012-08-20 13:01 -0700
Re: When is the complete type of an external definition known? Wojtek Lerch <wojtek_l@yahoo.ca> - 2012-08-20 16:58 -0400
Re: When is the complete type of an external definition known? pacman@kosh.dhis.org (Alan Curry) - 2012-08-21 00:44 +0000
Re: When is the complete type of an external definition known? Ike Naar <ike@sverige.freeshell.org> - 2012-08-20 05:57 +0000
Re: When is the complete type of an external definition known? Vlad from Moscow <vlad.moscow@mail.ru> - 2012-08-20 03:22 -0700
Re: When is the complete type of an external definition known? Ike Naar <ike@sverige.freeshell.org> - 2012-08-20 12:27 +0000
Re: When is the complete type of an external definition known? Jens Gustedt <jens.gustedt@loria.fr> - 2012-08-20 17:04 +0200
Re: When is the complete type of an external definition known? Ike Naar <ike@iceland.freeshell.org> - 2012-08-20 16:35 +0000
Re: When is the complete type of an external definition known? Jens Gustedt <jens.gustedt@loria.fr> - 2012-08-20 20:43 +0200
Re: When is the complete type of an external definition known? James Kuyper <jameskuyper@verizon.net> - 2012-08-20 08:46 -0400
Re: When is the complete type of an external definition known? Vlad from Moscow <vlad.moscow@mail.ru> - 2012-08-19 14:24 -0700
Re: When is the complete type of an external definition known? "Ersek, Laszlo" <lacos@caesar.elte.hu> - 2012-08-19 23:36 +0200
Re: When is the complete type of an external definition known? Vlad from Moscow <vlad.moscow@mail.ru> - 2012-08-19 14:46 -0700
csiph-web