[PATCH] Default initialize enum flags to 0
Simon Marchi
simon.marchi@ericsson.com
Mon Feb 20 21:46:00 GMT 2017
... 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
More information about the Gdb-patches
mailing list