New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Choose whether to put a space on the left or right of ...
and apply consistently throughout library
#430
Comments
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.] |
...
and apply consistently throughout library
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 |
My preference for the library would be |
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 |
My opinion is that being consistent (to help searching) is the goal. |
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:
or
or even
I think the first is enough. Moreover, are there any reasons to think things like Nope. 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. A If there are no other rules to force the use of |
Search N4296 for
class ...
There are a couple dozen occurrences of
class ... Meow
in Core, with similar function parameter packs. That's a questionable style, but not outright toxic.However, there are 4 occurrences of
class ...Args
in Library, which is yuck and bad and wrong. They are:30.3.1 [thread.thread.class]:
template <class F, class ...Args> explicit thread(F&& f, Args&&... args);
30.3.1.2 [thread.thread.constr]/3:
template <class F, class ...Args> explicit thread(F&& f, Args&&... args);
30.4 [thread.mutex]:
30.4.4.2 [thread.once.callonce]:
The text was updated successfully, but these errors were encountered: