GCC of that vintage included release notes in a file called NEWS
in the source tree. The GCC 2.5.8 distribution has the release notes of 2.5, which says:
- The C syntax for specifying which structure field comes next in an initializer is now
.FIELDNAME=
. The corresponding syntax for array
initializers is now [INDEX]=
. For example,
char whitespace[256]
= { [' '] = 1, ['\t'] = 1, ['\n'] = 1 };
This was changed to accord with the syntax proposed by the Numerical C
Extensions Group (NCEG).
The GCC developers had previously seen the need for an extension to C89 allowing for what we now call designated initializers (they called them "labeled elements"). So they had made up their own, following the syntax FIELDNAME: val
for structs and unions, and [INDEX] val
for arrays. Apparently the NCEG folks liked this but thought the other syntax would be better, though I'm not sure what significant difference they saw between them. So GCC switched to NCEG's preferred syntax, which is what eventually was adopted into C99.
The old syntax was then considered deprecated, but apparently support was never dropped, and when clang came along, it evidently picked it up in the interest of full GCC compatibility.
The early GCC designers were quite fond of adding extensions to the language whenever they thought they would be useful. Several of them eventually made it into C99 in one form or another, for instance long long int
, variable-length arrays, variadic macros, inline
, and __FUNCTION__
.