On 08/20/2018 06:51 AM, Markus Armbruster wrote:

Hmm, if we did this:

[IN_START_INTERPOL] {
   ['%'] = IN_INTERPOL,
   ['\t'] = IN_START_INTERPOL,
...
}

for similarity with all our other constructs, will gcc remember that
we've already initialized other members not listed in the clause
before, or will it mistakenly re-0-initialize the array members not
mentioned?

Fails make check.

(gdb) p json_lexer[IN_START_INTERPOL]
$1 = "\000\000\000\000\000\000\000\000\000\016\016\000\000\016", '\000' <repeats 18 times>, 
"\016\000\000\000\000\035", '\000' <repeats 217 times>

And thus answered my question - abbreviating causes gcc to re-zero-initialize any unmentioned members, so your override has to be one member at a time, as originally written.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to