🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3937

Re: Initialization of 'auto' char array

#3937
From: Mark Brader
Date: Wed, 06 Sep 1995 20:01
28 lines
1766 bytes
Thomas Wolf (wolf@lglsun.epfl.ch) asks:
> > In the initialization of a character array with fixed size with
> > automatic storage duration by a character string literal with
> > fewer characters (including the terminating null character) than
> > the array has elements, are the remaining array elements initialized
> > as if the array had static storage duration?
 
Larry Jones (scjones@thor.sdrc.com) answers:
> Yes.  The wording in the standard has been (or will be) corrected by
> a Technical Corrigendum to make this clear.

It's "will be"; this fix is part of TC2, which is currently up for balloting.

The proposed wording of the correction to 6.5.7 (which was 3.5.7 in ANSI
Classic) makes the applicable paragraph read as follows.  (Emphasis added.)
 
#  If there are fewer initializers in a brace-enclosed list than there
#  are members of an aggregate, OR FEWER CHARACTERS IN A STRING LITERAL
#  OR WIDE STRING LITERAL USED TO INITIALIZE AN ARRAY OF KNOWN SIZE, AND
#  ELEMENTS OF CHARACTER OR wchar_t TYPE, the remainder of the aggregate
#  shall be initialized implicitly the same as objects that have static
#  storage duration.
-- 
Mark Brader                "Things are getting too standard around here.
msb@sq.com                  Time to innovate!"
SoftQuad Inc., Toronto                  -- Ian Darwin and David Keldsen

My text in this article is in the public domain.
Technical Details
Message-ID: <1995Sep6.200152.18573@sq.com>
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!torn!sq!msb
References: <1995Sep6.111857@lglsun.epfl.ch> <42kgk6$79o@info1.sdrc.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!torn!sq!msb
From: msb@sq.com (Mark Brader)
Subject: Re: Initialization of 'auto' char array
Message-ID: <1995Sep6.200152.18573@sq.com>
Organization: SoftQuad Inc., Toronto, Canada
References: <1995Sep6.111857@lglsun.epfl.ch> <42kgk6$79o@info1.sdrc.com>
Date: Wed, 6 Sep 1995 20:01:52 GMT