ywkaras commented on code in PR #9482:
URL: https://github.com/apache/trafficserver/pull/9482#discussion_r1128826609


##########
iocore/net/NetVConnection.cc:
##########
@@ -118,3 +118,19 @@ NetVCOptions::get_family_string() const
   }
   return {};
 }
+
+void *
+NetVConnection::get_service(const std::type_info &info)
+{
+  if (this->_services.find(std::type_index(info)) != this->_services.end()) {
+    return this;
+  } else {
+    return nullptr;
+  }
+}

Review Comment:
   This will not work properly, for reasons illustrated by this example code:  
https://godbolt.org/z/bGofcYhse .  Not that f() and g() do not have the same 
assembly code.  With multiple inheritance, there is no known implementation 
(and probably impossible) where all the base classes to have the same (start) 
address as the derived class.  Even with no multiple inheritance, I think it's 
undefined behavior to assume that (direct and indirect) base classes have the 
same address as the derived class.  Although the de facto portability of this 
assumption is very high in that case.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to