avro-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [avro] thiru-mg commented on a change in pull request #1106: Core C++ implementation is modernized
Date Mon, 01 Mar 2021 03:02:33 GMT

thiru-mg commented on a change in pull request #1106:
URL: https://github.com/apache/avro/pull/1106#discussion_r584419806



##########
File path: lang/c++/api/Schema.hh
##########
@@ -51,95 +51,94 @@ public:
         return node_;
     }
 
-  protected:
-    Schema();
-    explicit Schema(const NodePtr &node);
-    explicit Schema(Node *node);
+ protected:
+    explicit Schema(NodePtr node) : node_(std::move(node)) {}
+    explicit Schema(Node *node) : node_(node) {}
 
     NodePtr node_;
 };
 
 class AVRO_DECL NullSchema : public Schema {
-public:
-    NullSchema(): Schema(new NodePrimitive(AVRO_NULL)) {}
+ public:
+    NullSchema() : Schema(new NodePrimitive(AVRO_NULL)) {}
 };
 
 class AVRO_DECL BoolSchema : public Schema {
-public:
-    BoolSchema(): Schema(new NodePrimitive(AVRO_BOOL)) {}
+ public:
+    BoolSchema() : Schema(new NodePrimitive(AVRO_BOOL)) {}
 };
 
 class AVRO_DECL IntSchema : public Schema {
-public:
-    IntSchema(): Schema(new NodePrimitive(AVRO_INT)) {}
+ public:
+    IntSchema() : Schema(new NodePrimitive(AVRO_INT)) {}
 };
 
 class AVRO_DECL LongSchema : public Schema {
-public:
-    LongSchema(): Schema(new NodePrimitive(AVRO_LONG)) {}
+ public:
+    LongSchema() : Schema(new NodePrimitive(AVRO_LONG)) {}
 };
 
 class AVRO_DECL FloatSchema : public Schema {
-public:
-    FloatSchema(): Schema(new NodePrimitive(AVRO_FLOAT)) {}
+ public:
+    FloatSchema() : Schema(new NodePrimitive(AVRO_FLOAT)) {}
 };
 
 class AVRO_DECL DoubleSchema : public Schema {
-public:
-    DoubleSchema(): Schema(new NodePrimitive(AVRO_DOUBLE)) {}
+ public:
+    DoubleSchema() : Schema(new NodePrimitive(AVRO_DOUBLE)) {}
 };
 
 class AVRO_DECL StringSchema : public Schema {
-public:
-    StringSchema(): Schema(new NodePrimitive(AVRO_STRING)) {}
+ public:
+    StringSchema() : Schema(new NodePrimitive(AVRO_STRING)) {}
 };
 
 class AVRO_DECL BytesSchema : public Schema {
-public:
-    BytesSchema(): Schema(new NodePrimitive(AVRO_BYTES)) {}
+ public:
+    BytesSchema() : Schema(new NodePrimitive(AVRO_BYTES)) {}
 };
 
 class AVRO_DECL RecordSchema : public Schema {
-public:
-    RecordSchema(const std::string &name);
+ public:
+    explicit RecordSchema(const std::string &name);

Review comment:
       You are right, but very unlikely. I try to avoid explicit, where automatic conversion
is handy. E.g conversion of different types to GenericDatum. I don't think anyone would have
automatically converted a string into RecordSchema. If they have done, it makes sense for
them to make their intention explicit.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message