Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coding-rules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Scott Snyder
coding-rules
Commits
c3c186a8
Commit
c3c186a8
authored
1 year ago
by
scott snyder
Browse files
Options
Downloads
Patches
Plain Diff
minor fixes
parent
7fa5168c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rules.org
+3
-27
3 additions, 27 deletions
rules.org
with
3 additions
and
27 deletions
rules.org
+
3
−
27
View file @
c3c186a8
...
@@ -2108,7 +2108,7 @@ public:
...
@@ -2108,7 +2108,7 @@ public:
Experience has shown that exception specifications are generally not useful
Experience has shown that exception specifications are generally not useful
and non-empty exception specifications are now an error [fn:Sutter02].
and non-empty exception specifications are now an error [fn:Sutter02].
They should not be used in new code.
They should not be used in new code
, and are not allowed in C++20
.
There is also the keyword =noexcept=. The motivation for this was
There is also the keyword =noexcept=. The motivation for this was
really to address a specific problem with move constructors and
really to address a specific problem with move constructors and
...
@@ -2246,29 +2246,6 @@ std::string aCPPString("Hello Atlas");
...
@@ -2246,29 +2246,6 @@ std::string aCPPString("Hello Atlas");
printf("This does not work: %s \n", aCPPString);
printf("This does not work: %s \n", aCPPString);
//Core dump again
//Core dump again
#+END_EXAMPLE
#+END_EXAMPLE
#+BEGIN_COMMENT
Another example, from Control/StoreGateSvc.cxx:
#+BEGIN_EXAMPLE
#include <iostream>
#include <sstream>
..............
std::ostringstream ost;
..............
// loop over each type:
SG::ConstProxyIterator p_iter = (s_iter->second).begin();
SG::ConstProxyIterator p_end = (s_iter->second).end();
while (p_iter != p_end) {
const DataProxy& dp(*p_iter->second);
ost << " flags: ("
<< setw(7) << (dp.isValid() ? "valid" : "INVALID") << ", "
<< setw(8) << (dp.isConst() ? "locked" : "UNLOCKED") << ", "
<< setw(6) << (dp.isResetOnly() ? "reset" : "DELETE")
<< ") --- data: " << hex << setw(10) << dp.object() << dec
<< " --- key: " << p_iter->first << '\n';
++p_iter;
}
#+END_EXAMPLE
#+END_COMMENT
It is of course acceptable to use stdio functions if you're calling
It is of course acceptable to use stdio functions if you're calling
an external library that requires them.
an external library that requires them.
...
@@ -2291,7 +2268,7 @@ void error(int severity, ...) // "severity" followed by a
...
@@ -2291,7 +2268,7 @@ void error(int severity, ...) // "severity" followed by a
This method should be avoided.
This method should be avoided.
As of C++
11, one can accomplish something similar using varadic
As of C++11, one can accomplish something similar using varadic
templates:
templates:
#+BEGIN_EXAMPLE
#+BEGIN_EXAMPLE
...
@@ -2604,7 +2581,6 @@ float ip_cut = 0.1 * Gaudi::Units::cm;
...
@@ -2604,7 +2581,6 @@ float ip_cut = 0.1 * Gaudi::Units::cm;
may be found at [fn:Cxx20]. However, the standards documents are not
may be found at [fn:Cxx20]. However, the standards documents are not
very readable. A better reference for most questions about what is in the
very readable. A better reference for most questions about what is in the
standard is the cppreference.com website [fn:cppreference].
standard is the cppreference.com website [fn:cppreference].
At some point, compatibility with C++23 will also be required.
At some point, compatibility with C++23 will also be required.
...
@@ -2641,7 +2617,7 @@ float ip_cut = 0.1 * Gaudi::Units::cm;
...
@@ -2641,7 +2617,7 @@ float ip_cut = 0.1 * Gaudi::Units::cm;
fail elsewhere.
fail elsewhere.
The ATLAS convention is to include the package name followed by the file name.
The ATLAS convention is to include the package name followed by the file name.
Watch out: list the package name twice is wrong, but some build systems
Watch out: list
ing
the package name twice is wrong, but some build systems
don't catch it.
don't catch it.
#+BEGIN_EXAMPLE
#+BEGIN_EXAMPLE
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment