Thread: exception handling classes in IRIX....?

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    72

    exception handling classes in IRIX....?

    I'm coming up empty on finding a solution to this problem, so I'll just hang it out there... When compiling code that would otherwise compile under Windows or Linux, IRIX is giving me problems with the definition of "what." here's the code:
    Code:
    using namespace std;
    
    class MyException : public exception {
    public:
      MyException(const string &message, bool inclSysMsg = false);
    
      const char *what() const;  // <~~line 43
    
    private:
      string userMessage;  // Exception message
    };
    
    const char *MyException::what() const {
      return userMessage.c_str();
    }
    when I compile under IRIX, I get:
    Code:
    "myfile.h", line 43: error(3217): exception specification for virtual
              function "MyException::what" is incompatible with that of
              overridden function "std::exception::what"
        const char *what() const;
                    ^
    I'm a novice when it comes to exception handling, and, unfortunately, I don't have any books on the subject (though one is on order). Can someone offer a bit of advice, or point me in the direction of some source of information that might get me through this?
    Last edited by BrianK; 01-24-2003 at 05:40 PM.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    it should be...

    const char* what() const throw();
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    72
    Originally posted by Stoned_Coder
    it should be...

    const char* what() const throw();
    Never said thanks about this - it worked. saved several hairs from an imminent and decisive end.

    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. signal handling and exception handling
    By lehe in forum C++ Programming
    Replies: 2
    Last Post: 06-15-2009, 10:01 PM
  2. Exception handling in a large project
    By EVOEx in forum C++ Programming
    Replies: 7
    Last Post: 01-25-2009, 07:33 AM
  3. exception handling
    By coletek in forum C++ Programming
    Replies: 2
    Last Post: 01-12-2009, 05:28 PM
  4. is such exception handling approach good?
    By George2 in forum C++ Programming
    Replies: 8
    Last Post: 12-27-2007, 08:54 AM
  5. Exception handling framework based on multiple inheritance
    By Mario F. in forum C++ Programming
    Replies: 11
    Last Post: 06-25-2007, 10:17 AM