lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] odd/c02 f67cec4 1/2: Explain why 'C0' is kept even t


From: Greg Chicares
Subject: [lmi-commits] [lmi] odd/c02 f67cec4 1/2: Explain why 'C0' is kept even though '0_cents' is available
Date: Sun, 9 May 2021 10:20:56 -0400 (EDT)

branch: odd/c02
commit f67cec4ae968e03cffe44605eddc10e33c8321da
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Explain why 'C0' is kept even though '0_cents' is available
---
 currency.hpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/currency.hpp b/currency.hpp
index 8a6ce9f..ecfb177 100644
--- a/currency.hpp
+++ b/currency.hpp
@@ -145,13 +145,12 @@ inline std::vector<double> dblize(std::vector<currency> 
const& z)
     return r;
 }
 
-/// Zero cents--akin to a user-defined literal.
+/// Zero cents as a compile-time constant.
 ///
-/// UDLs seem less convenient because the obvious "0_c" is likely to
-/// collide with some other UDL, and "currency::0_c" is too verbose.
-/// "0_cents" may avoid both those problems, but "C0" is terser.
-/// "C0" is chosen instead of "c0" only for the pixilated reason that
-/// the capital letter looks kind of like a "0".
+/// This particular value occurs so often that it merits a terse name,
+/// no wider than '0.0'. Unlike '0_cents', 'C0' can be used in a
+/// context that requires a compile-time constant; otherwise, both
+/// perform equally well in optimized builds.
 
 inline constexpr currency C0 = {};
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]