Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | pacman@kosh.dhis.org (Alan Curry) |
|---|---|
| Newsgroups | comp.std.c |
| Subject | Re: When is the complete type of an external definition known? |
| Date | 2012-08-21 00:44 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <k0ulkh$tk7$1@speranza.aioe.org> (permalink) |
| References | <653592d3-2e3d-4252-baae-cf1da6fb18e9@googlegroups.com> <fdc7ea7c-759a-4300-b396-36aad059fb58@googlegroups.com> <ln1uj2l2tk.fsf@nuthaus.mib.org> <a9f1hmFe4bU1@mid.individual.net> |
In article <a9f1hmFe4bU1@mid.individual.net>, Wojtek Lerch <wojtek_l@yahoo.ca> wrote: >On 19-Aug-12 10:22 PM, Keith Thompson wrote: >> Vlad from Moscow <vlad.moscow@mail.ru> writes: >>> понедельник, 20 августа 2012 г., 1:56:49 UTC+4 >пользователь Ike Naar написал: >>>> On 2012-08-19, Vlad from Moscow <vlad.moscow@mail.ru> wrote: >> [...] >>>> 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." >> >> ... (more precisely a constraint violation). > >Actually that paragraph is in a Semantics section, not in a Constraints >section. It's plain undefined behaviour without a promise of a diagnostic. > >Out of curiosity, does anybody know the reason for this restriction? It >sounds like a useful thing to be able to do. (And I have to admit that >did it more than once, before I knew about this.) Is it because >different compilers used to interpret it differently back in the day, >and the standard didn't want to break them? The Rationale doesn't seem >to mention "tentative" at all. When I asked this question before, the most believable answer was that ancient compilers didn't handle this case because it would have required a second compiler pass. Without the static keyword, the linker could finish up whatever the compiler couldn't do in its single pass. With static, the linker didn't get enough information. Assuming the last of the single-pass compilers has finally died out, it should be possible to get this fixed. It needs someone who cares enough to make it an official proposal. -- Alan Curry
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