svn commit: r302252 - head/sys/kern
Ed Schouten
ed at nuxi.nl
Mon Jul 4 08:26:02 UTC 2016
2016-07-04 2:47 GMT+02:00 Benjamin Kaduk <bjkfbsd at gmail.com>:
> I did not think that .th_offset.tv_sec was valid [...]
It is valid. The ".field = value" construct is called a 'designator'
in C's grammar specification. What's on the left of the assignment is
called a 'designator-list', which may consist of 1 or more
'designators'. There are two types of designators:
'[constant-expression]' and '.identifier'. In other words, it is
completely valid to write the following:
struct foo bar = {
.field[123].something = 456,
.field[124].somethingelse = 789,
};
Which is the same as:
struct foo bar = {
.field = {
[123].something = 456,
[124].somethingelse = 789,
},
};
And:
struct foo bar = {
.field = {
[123] = { .something = 456 },
[124] = { .somethingelse = 789 },
},
};
Best regards,
--
Ed Schouten <ed at nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
More information about the svn-src-head
mailing list