Page MenuHomeFreeBSD

Add info about c99 designationed initializers.
ClosedPublic

Authored by imp on Jan 18 2018, 9:27 PM.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

imp created this revision.Jan 18 2018, 9:27 PM
imp added a reviewer: cem.Jan 18 2018, 9:27 PM
cem accepted this revision.Jan 18 2018, 9:29 PM
This revision is now accepted and ready to land.Jan 18 2018, 9:29 PM
jhb accepted this revision.Jan 18 2018, 9:34 PM
mjoras accepted this revision.Jan 18 2018, 9:35 PM
np accepted this revision.Jan 18 2018, 9:43 PM
vangyzen accepted this revision.Jan 18 2018, 9:44 PM
rpokala accepted this revision.Jan 19 2018, 1:00 AM
hselasky accepted this revision.Jan 19 2018, 7:35 AM
bapt accepted this revision.Jan 19 2018, 9:09 AM
manu accepted this revision.Jan 19 2018, 9:18 AM
ed added a subscriber: ed.Jan 19 2018, 10:26 AM

Is there a need to describe how these should be formatted? Can we place multiple initializers on one line, or should they all be placed on a separate one? Tabs before the = to align them?

Also a one line sample is always good.
Ed suggests do we or do we not use tab to align =, this should be clarified.
Iirc in the places that we do use any initializer in the current code it is spaces on each side of = just as in assignment statements.

share/man/man9/style.9
327 ↗(On Diff #38186)

"Likewise," is a noise word, can it be removed?

Can we add after his:
.Bd -literal
sample code
.Ed
please

hselasky added a comment.EditedJan 19 2018, 5:02 PM

Instead of referring C99 initializers, you can also say: initialization of structures and unions by record is preferred.

cem added a comment.EditedJan 19 2018, 5:05 PM

This review was a lot less controversial and bikesheddy before discussing prescribed syntax. I'd propose Warner just make the original, unopposed verbiage change and we trust people to do something reasonable. If it becomes a problem we can go into greater detail, but people already use C99 designed initializers in the project today and most use seems fine. Or, still make the original, unopposed change first, then open a 2nd separate review for the bikeshed.

Instead of referring C99 initializers, you can also say: initialization of structures and unions by record is preferred.

Isn't this just a less specific way of saying the same thing?

imp added a comment.Jan 19 2018, 6:56 PM
In D13975#293289, @ed wrote:

Is there a need to describe how these should be formatted? Can we place multiple initializers on one line, or should they all be placed on a separate one? Tabs before the = to align them?

No. There's no need. There's no pattern in the tree that's universal, so we should remain silent about this. The only thing that's generally done is separate lines, but even that's not universal.

imp added inline comments.Jan 19 2018, 6:59 PM
share/man/man9/style.9
327 ↗(On Diff #38186)

Likewise is in the style of the rest of the document, so I'll let other clean up the chatty style.
I'm loathe to add an example since there's a diversity of styles in the tree and it isn't clear to me which one to promulgate absent good statistical data.

imp added a comment.Jan 19 2018, 7:00 PM
In D13975#293403, @cem wrote:

This review was a lot less controversial and bikesheddy before discussing prescribed syntax. I'd propose Warner just make the original, unopposed verbiage change and we trust people to do something reasonable. If it becomes a problem we can go into greater detail, but people already use C99 designed initializers in the project today and most use seems fine. Or, still make the original, unopposed change first, then open a 2nd separate review for the bikeshed.

Instead of referring C99 initializers, you can also say: initialization of structures and unions by record is preferred.

Isn't this just a less specific way of saying the same thing?

I think it's changing allowed to preferred. :) Also, I find that wording to be less clear.

ian accepted this revision.Jan 25 2018, 3:25 PM
This revision was automatically updated to reflect the committed changes.