Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Choose whether to put a space on the left or right of `...` and apply consistently throughout library #430
Search N4296 for
There are a couple dozen occurrences of
However, there are 4 occurrences of
I'm curious what your argument is here; is it just aesthetic, or is there some more fundamental reason?
[My general feeling is that the formatting of code samples in the C++ standard should reflect the C++ language as well as possible. To this end, the core language deliberately uses a mixture of styles to emphasize that whitespace doesn't matter. The library specification lives in a somewhat different world; it should stick to a single consistent style. All else being equal, I think it would make sense for that style to match the C++ grammar (rather than only working in common but special cases -- one declarator per declaration, no postfix declarators, no paren declarators), because that would improve the internal consistency of the standard.]
It's purely an aesthetic argument. In the Library, we think of
I see your point about Core mixing styles, and I don't think that it needs to change. If you are tempted to change Library to say
I vote for grammar. Standand's wording should honor it (so we all don't forget there's no such thing as the type is the thing on the left) and leave aesthetics as a deciding factor over the grammar to our own codebases.
I completely agree with @zygoloid in his two points:
I recall a recent well known book, by known author, by known reviewers, which contained
I personally strongly prefer
This stuff of syntax problem is clearly a clone of
Note there are two different kinds of use cases.
Since C++ allows creating new types only in declarations, they are even more explicit and easier to be differentiated.
Well, I know it is sometimes reasonable to keep these punctuations (
But this is certainly not fit for all cases. If there is no chance to be ambiguous, why I must care to avoid it?
Yes, they are inconsistent. However, this is the original design of C, and it would probably never be changed by C++ (damn compatibility ...).
So don't cheat newbies, let them be as-is.
One can also easily make convention to allow only one style:
I think the first is enough.
Moreover, are there any reasons to think things like
Now pay attention to
We can't get the ambiguity just by put
Here comes the reason I've found to support my point: the formal syntax.
If there are no other rules to force the use of