You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by mreve <gi...@git.apache.org> on 2015/05/03 12:23:37 UTC

[GitHub] thrift pull request: Thrift 727 - support C++ native exception mes...

Github user mreve commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/469#discussion_r29554828
  
    --- Diff: compiler/cpp/src/generate/t_cpp_generator.cc ---
    @@ -1626,6 +1640,16 @@ void t_cpp_generator::generate_struct_ostream_operator_decl(std::ofstream& out,
       out << "std::ostream& operator<<(std::ostream& out, const " << tstruct->get_name() << "& obj)";
     }
     
    +void t_cpp_generator::generate_exception_what_method_decl(std::ofstream& out,
    +                                                          t_struct* tstruct,
    +                                                          bool external) {
    +  std::string prefix = "";
    +  if (external) {
    +    prefix = string(tstruct->get_name() + "::");
    +  }
    +  out << "const char* " << prefix << "what() const throw()";
    --- End diff --
    
    It may be, but TException implements what() using this definition. Removing "throw()" results in compilation error: "overriding 'virtual const char* apache::thrift::TException::what() const throw ()'".
    
    However, I believe I can just implement it without concatenating strings specifically.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---