[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 905df77: Use constexpr instead of enum for de
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 905df77: Use constexpr instead of enum for defining constants |
Date: |
Mon, 19 Apr 2021 22:15:31 -0400 (EDT) |
branch: master
commit 905df77be8cc9dad3c5f1181bb2d6f087c9d7b3d
Author: Vadim Zeitlin <vadim@tt-solutions.com>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Use constexpr instead of enum for defining constants
This is more semantically correct and also avoids clang warning about
using enums from different enumeration types in arithmetic when these
values are multiplied by each other in authenticity.cpp:
arithmetic between different enumeration types ('(anonymous enum
at md5sum.hpp:40:1)' and '(anonymous enum at md5sum.hpp:38:1)') is
deprecated [-Werror,-Wdeprecated-anon-enum-enum-conversion]
---
md5sum.hpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/md5sum.hpp b/md5sum.hpp
index d09afd2..4f98e77 100644
--- a/md5sum.hpp
+++ b/md5sum.hpp
@@ -35,9 +35,9 @@
// The gnu libc md5 implementation seems to assume this:
static_assert(8 == CHAR_BIT || 16 == CHAR_BIT);
// so md5 output is 128 bits == 16 8-bit bytes or 8 16-bit bytes:
-enum {md5len = 128 / CHAR_BIT};
+constexpr int md5len = 128 / CHAR_BIT;
-enum {chars_per_formatted_hex_byte = CHAR_BIT / 4};
+constexpr int chars_per_formatted_hex_byte = CHAR_BIT / 4;
enum class md5_file_mode
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [lmi] master 905df77: Use constexpr instead of enum for defining constants,
Greg Chicares <=