Created on 2008-10-26.00:00:00 last changed 179 months ago
[Voted into WP at October, 2009 meeting.]
Proposed resolution (September, 2009):
Add a new paragraph following 9.4.3 [dcl.init.string] paragraph 2:
There shall not be more initializers than there are array elements. [Example:
char cv[4] = "asdf"; // error
is ill-formed since there is no space for the implied trailing '\0'. —end example]
If there are fewer initializers than there are array elements, then each element not explicitly initialized shall be zero-initialized (9.4 [dcl.init]).
The current specification of string initialization in 9.4.3 [dcl.init.string] leaves uninitialized all characters following the terminating '\0' of a character array with automatic storage duration. This is different from C99, in which string initialization is handled like aggregate initialization and all trailing characters are zeroed (6.7.8 paragraph 21).
(See also issue 694, in which we are considering following C99 in a somewhat similar case of zero-initializing trailing data.)
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | status: dr -> cd2 |
2009-11-08 00:00:00 | admin | set | messages: + msg2457 |
2009-11-08 00:00:00 | admin | set | status: tentatively ready -> dr |
2009-09-29 00:00:00 | admin | set | messages: + msg2298 |
2009-09-29 00:00:00 | admin | set | status: drafting -> tentatively ready |
2009-08-03 00:00:00 | admin | set | status: open -> drafting |
2008-10-26 00:00:00 | admin | create |