This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Default initialize enum flags to 0
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Simon Marchi <simon dot marchi at ericsson dot com>
- Date: Mon, 20 Feb 2017 16:45:48 -0500
- Subject: [PATCH] Default initialize enum flags to 0
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon dot marchi at ericsson dot com;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
... so that we don't need to do it manually, and potentially forget.
For example, this allows to do:
my_flags flags;
...
flags |= some_flag;
gdb/ChangeLog:
* common/enum-flags.h (enum_flags::enum_flags): Initialize
m_enum_value to 0 in default constructor.
---
gdb/common/enum-flags.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/gdb/common/enum-flags.h b/gdb/common/enum-flags.h
index 5b8c3ebc32..b1cf9a4644 100644
--- a/gdb/common/enum-flags.h
+++ b/gdb/common/enum-flags.h
@@ -117,6 +117,7 @@ private:
public:
/* Allow default construction, just like raw enums. */
enum_flags ()
+ : m_enum_value ((enum_type) 0)
{}
enum_flags (const enum_flags &other)
--
2.11.0