-
Notifications
You must be signed in to change notification settings - Fork 273
Add brace initialisers to coding standard #3546
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
Add brace initialisers to coding standard #3546
Conversation
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'm largely a "don't care" on this one - I find it visually displeasing, but that's probably just because I'm not yet used to it. So I'll have someone else approve. (The major benefit mentioned in the PR description I'd just comment on with "use explicit.")
@@ -209,6 +209,8 @@ Formatting is enforced using clang-format. For more information about this, see | |||
point to heap-allocated memory should be private data members of an object | |||
which safely manages the pointer. As such, `new` should only be used in | |||
constructors, and `delete` in destructors. Never use `malloc` or `free`. | |||
- Prefer brace style initialisation (i.e. `type_name{arguments...}`) over | |||
parentheses for constructor calls |
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.
parentheses for constructor calls | |
parentheses for constructor calls. |
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 PR failed Diffblue compatibility checks (cbmc commit: 38b1b98).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/94044400
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
This is also in CPPCoreGuidelines, which we obviously don't follow atm but I feel like if we don't have a particular preference either way going with those is a good start. They also have more detailed reasoning for their recommendations most of the time. |
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'm all for it, especially for the benefit of not allowing implicit narrowing conversions.
Major benefit:
Minor benefits:
type_name variable_name{};
instead oftype_name variable_name;
(parentheses version doesn't work because it's indistinguishable from a function declaration)