This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 16/22] Class-ify ui_out_level


On 2016-11-24 13:41, Pedro Alves wrote:
-struct ui_out_level
+/* A level of nesting (either a list or a tuple) in a ui_out output. */
+
+class ui_out_level
+{
+ public:
+
+  ui_out_level (ui_out_type type)

explicit ?

I had a discussion about this with Antoine. Is it a good practice to use explicit all the time, and only omit it when there's a good reason why? I initially put it on all the constructors, but decided to drop it after our discussion.

+  : m_type (type),
+    m_field_count (0)
   {
- /* Count each field; the first element is for non-list fields. */
-    int field_count;
-    /* The type of this level.  */
-    enum ui_out_type type;
-  };
+  }
+
+  ui_out_type type (void) const

"(void)" is not necessary in C++ (and not very idiomatic).

I saw this in several places in the series.

Ok, I fixed all the instances I found.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]