From c3c186a801785209377d285d06f7bd6241d3dcf5 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Wed, 28 Feb 2024 22:08:38 -0500 Subject: [PATCH] minor fixes --- rules.org | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/rules.org b/rules.org index ba430b4..21c33f4 100644 --- a/rules.org +++ b/rules.org @@ -2108,7 +2108,7 @@ public: Experience has shown that exception specifications are generally not useful 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 really to address a specific problem with move constructors and @@ -2246,29 +2246,6 @@ std::string aCPPString("Hello Atlas"); printf("This does not work: %s \n", aCPPString); //Core dump again #+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 an external library that requires them. @@ -2291,7 +2268,7 @@ void error(int severity, ...) // "severity" followed by a 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: #+BEGIN_EXAMPLE @@ -2604,7 +2581,6 @@ float ip_cut = 0.1 * Gaudi::Units::cm; 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 standard is the cppreference.com website [fn:cppreference]. - At some point, compatibility with C++23 will also be required. @@ -2641,7 +2617,7 @@ float ip_cut = 0.1 * Gaudi::Units::cm; fail elsewhere. 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: listing the package name twice is wrong, but some build systems don't catch it. #+BEGIN_EXAMPLE -- GitLab