-
Notifications
You must be signed in to change notification settings - Fork 764
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
P3471R4 Standard library hardening #7703
base: main
Are you sure you want to change the base?
Conversation
@jwakely I have had some issues when creating this PR:
|
The old note was semantically connected to the preconditions paragraph but placed in a bad (IMO) place. I guess the intent wasn't attaching the note to the paragraph, but such attaching seems to be an editorial improvement to me.
I think it's safest to mirror changes. |
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.
The paper was applied correctly except for 2 missing edits, but there were other issues - see comments.
A freestanding | ||
implementation is one in which execution may take place without the benefit of |
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.
Not your doing (from existing text), but wanted to point out that this is where the \defnadj for "freestanding implementation" should be (not above) since this is the definition. Same for "hosted implementation" in the sentence below.
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 we want the defnadj
to be on the first occurrence of the term.
It is | ||
\impldef{whether the implementation is a hardened implementation} | ||
whether the implementation is a | ||
\defnadj{hardened}{implementation}. |
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.
Also not your doing (from paper), but this doesn't define what a "hardened implementation" is - what is it?
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.
It's not uncommon that we use definition italics for things that aren't really explained, but simply the first occurrence of that term. I wouldn't be opposed to some semi-normative wording that attempts to define it, but that seems outside the scope of this PR, even considering fixups.
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.
The way it was stated in R2 was "A hardened implementation is one in which violating a hardened precondition is a contract violation." That is a bit more like an actual definition, but I don't think it's a problem the way R4 is phrased. We specify the properties of a hardened implementation, and say it's implementation-defined whether the implementation is one. That's sufficient IMHO. An impl has to say if it is or isn't one, and if it is, we say how that affects behaviour.
\item | ||
\expects | ||
the conditions | ||
that the function assumes to hold whenever it is called; | ||
conditions that the function assumes to hold whenever it is called; | ||
violation of any preconditions results in undefined behavior. | ||
|
||
\item | ||
\hardexpects | ||
conditions that the function assumes to hold whenever it is called. |
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 is a problem with existing source, but also the new source since it's following the existing convention:
- \clauses should always be preceded with a \pnum, not an \item, and
- Sentences following each \clause should start with capital letter.
prior to any other observable side effects of the function, | ||
one or more contract assertions | ||
whose predicates are as described in the hardened precondition | ||
are evaluated with a checking semantic\iref{basic.contract.eval}. |
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.
[basic.contract.eval] doesn't exist; is it being added by one of the other motions?
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.
#7695 is adding that section.
@@ -9372,7 +9372,7 @@ | |||
|
|||
\begin{itemdescr} | |||
\pnum | |||
\expects | |||
\hardexpects |
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.
Missing 2 of these edits around line 9418 for [expected.void.obs]/p7 and line 9435 for expected.void.obs/p9.
@@ -837,6 +856,11 @@ | |||
Freestanding implementations should only define a macro from \libheader{version} | |||
if the implementation provides the corresponding facility in its entirety. | |||
|
|||
\pnum | |||
\recommended |
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.
Does it make sense to have 2 \recommendeds following each other like this, verses having a bulleted list under a single \recommended?
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 it would be stylistically better if there was a single paragraph, and I don't even think that bullets are required.
However, it's not really wrong, and CWG signed off on it knowing that there are two recommendations in a row, so I'm not sure if that's a fixup candidate.
Fixes #7674.
Fixes cplusplus/papers#2125.