-
Notifications
You must be signed in to change notification settings - Fork 767
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
OK, error, ambiguous consistency of comments in examples. #971
Conversation
bcaa114
to
cd7bd3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs more of a case-by-case approach. A colon makes sense when the following wording is the reason why the line is OK or an error, but does not make sense when we're saying both that it's OK (say) and something else about it. I've marked up some individual cases that are better without this change.
@@ -840,15 +840,15 @@ | |||
class Y; | |||
extern void b(); | |||
class A { | |||
friend class X; // OK, but \tcode{X} is a local class, not \tcode{::X} | |||
friend class X; // OK: but \tcode{X} is a local class, not \tcode{::X} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should stay as a comma
friend void b(); // OK | ||
friend void c(); // error | ||
}; | ||
X* px; // OK, but \tcode{::X} is found | ||
Z* pz; // error, no \tcode{Z} is found | ||
X* px; // OK: but \tcode{::X} is found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too.
@@ -945,7 +945,7 @@ | |||
|
|||
typedef int I; | |||
class D { | |||
typedef I I; // error, even though no reordering involved | |||
typedef I I; // error: even though no reordering involved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should stay as-is.
@@ -905,7 +905,7 @@ | |||
\begin{codeblock} | |||
constexpr int f(bool b) | |||
{ return b ? throw 0 : 0; } // OK | |||
constexpr int f() { return f(true); } // ill-formed, no diagnostic required | |||
constexpr int f() { return f(true); } // ill-formed: no diagnostic required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should stay as-is, and likewise for other "ill-formed, no diagnostic required" cases.
@@ -1683,8 +1683,8 @@ | |||
body. | |||
\begin{example} | |||
\begin{codeblock} | |||
auto f() { } // OK, return type is \tcode{void} | |||
auto* g() { } // error, cannot deduce \tcode{auto*} from \tcode{void()} | |||
auto f() { } // OK: return type is \tcode{void} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should stay as a comma. (We're not saying it's OK because the return type is void
, we're saying both (a) it's OK, and (b) the return type is void
.)
@@ -620,7 +620,7 @@ | |||
or allow it to be changed through a cv-unqualified pointer later, for example: | |||
|
|||
\begin{codeblock} | |||
*ppc = &ci; // OK, but would make \tcode{p} point to \tcode{ci} ... | |||
*ppc = &ci; // OK: but would make \tcode{p} point to \tcode{ci} ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should stay as a comma.
@@ -2271,7 +2271,7 @@ | |||
|
|||
\begin{codeblock} | |||
struct onlydouble { | |||
onlydouble() = delete; // OK, but redundant | |||
onlydouble() = delete; // OK: but redundant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should be left alone.
@@ -2706,7 +2706,7 @@ | |||
\begin{codeblock} | |||
int f(bool b) { | |||
unsigned char c; | |||
unsigned char d = c; // OK, \tcode{d} has an indeterminate value | |||
unsigned char d = c; // OK: \tcode{d} has an indeterminate value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should probably be left alone, since it's really saying "OK, but d
has an indeterminate value"
That makes sense to me. Is the list of comments what should be reverted exhaustive? |
Here's some tangential guidance: We all agreed that By contrast, "OK" doesn't generally have a natural explanation other than "it's OK because it follows the rules of the standard". Any additional explanation that you choose to call out is subjective. So we're actually fine with `OK, ..." in general, but we can discuss individual change suggestions. But expect that part of the change to take more work. |
@vgvassilev: ping - this PR needs rebasing. |
c3cc50b
to
d18f666
Compare
Rebased, addressing @zygoloid's comments. |
@tkoeppe thanks for the comments. Who is "we"? I am happy to remove the OK part of the PR if requested. I feel some of these substitutions are valid. |
@vgvassilev: Please rebase and rescan the draft for new occurrences of the style you're changing. |
…ng out of a parallel algorithm terminates—but how? As directed by LWG Motion 21 from 2016-Isaquah.
Revert some of the mechanical * OK: back to OK, * ill-formed, no diagnostic required back to ill-formed, no diagnostic required * error: -> error, (in one case).
d18f666
to
ebdef95
Compare
@tkoeppe Done. It seems somebody did push -f and rewrote the history of the master, sigh... There are a few occurrences of |
@vgvassilev: I'm sorry. We do that extremely rarely, and never after more than five or so minutes after a push. Very sorry if you got caught in a force-push. |
@zygoloid: I think you liked this PR in general. Could you review the updated situation? |
base(); | ||
}; | ||
struct derived : base {}; | ||
|
||
derived d1{}; // Error. The code was well-formed before. | ||
derived d1{}; // error: the code was well-formed before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically, it's not an error because it was OK before. After the change the comment makes no sense. The comment is saying "This is an error but it was OK before" and the current text says that much better.
I don't think any of the Overall, I think this is an attempt to impose an unnecessarily rigid rule on free-text comments, which don't need to be globally consistent to some fixed rule. Local consistency and clarity of meaning is probably more important. As the current patch actually changes meaning in some cases and decreases legibility in other cases, I think it would make the standard worse, not better. Individual pieces of this change would be fine where they improve clarity, but I don't like trying to address every instance at once just in the name of consistency. |
See #5080 for further cleanup for "OK" |
Current stats:
This PR introduces:
If you consider this as an improvement please merge.