-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a Timings* in place of optional<Timings>* (#4607)
The current representation has two nested presence indicatators (the optional bool, the null pointer). Currently the pointer is never null, but the style guide suggests that T* should be used for parameters that may or may not be present, so we do not need the optional here. > When passing an object's address as an argument, use a reference > unless one of the following cases applies: > > - If the parameter is optional, use a pointer and document that it > may be null. Once the parameter is just a pointer, the ScopedTiming field does not need an optional either, and can just store the pointer. It would be more preferable to have an optional representation of a sometimes-null pointer like optional<T&> to describe a sometimes-null pointer, as this would allow clearer runtime diagnostics when used incorrectly (a check failure in unwrapping) and would be better self-documenting through syntax instead of a comment. But we do not currently have such a primitive.
- Loading branch information
Showing
3 changed files
with
17 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters