draft ANSI standard: "..." initializer should work on any object
John Gilmore
gnu at hoptoad.uucp
Fri Jan 2 13:52:40 AEST 1987
In section 3.5.6 on page 62, the draft standard says:
An array of characters may be initialized by a string literal,
optionally enclosed in braces. Successive characters of the
string literal...initialize the members of the array.
Otherwise, the initializer for an object that has aggregate type
shall be a brace-enclosed list...
I believe this should be modified to say:
An array may be initialized by a string literal...
(delete "of characters"). This allows people who are
doing explicit large-character-set work to use e.g. short, thus:
short stuff[] = "string of 16bit chars";
There is no reason to prohibit even:
double mint[] = "fooba";
just as we don't prohibit:
double trouble = 'f';
Why should we force people to write:
short stuff[] = {'s', 't', 'r', 'i', 'n', 'g', ' ', 'o', 'f', ' ', '1',
'6', 'b', 'i', 't', ' ', 'c', 'h', 'a', 'r', 's'};
?
--
John Gilmore {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu gnu at ingres.berkeley.edu
I forsee a day when there are two kinds of C compilers: standard ones and
useful ones ... just like Pascal and Fortran. Are we making progress yet?
-- ASC:GUTHERY%slb-test.csnet
More information about the Comp.lang.c
mailing list