Results 1 to 3 of 3

Thread: Have CL_Error inherit from std::exception

  1. #1

    Default Have CL_Error inherit from std::exception

    I think it would be a wide idea for CL_Error to inherit from std::exception to make catching of exceptions a tad bit easier. I don't think it's that much of a hassle. Just have CL_Error inherit from std::exception and implement the function:
    Code:
    const char* what() const throw() { return message.c_str(); }
    And implement a non-throwing destructor:
    Code:
    ~CL_Error() throw() {}

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    Just noticed this old request.

    CL_Error (CL_Exception in 0.9) does not inherit from std::exception mostly for historic reasons. The problem is that standard compliance amongst C++ compilers have generally been fairly poor when it comes to certain details. I believe that in the older Visual C++ compilers std::exception was not defined (although I could be wrong). Right now we don't derive from it to avoid possible problems with earlier versions of C++ compilers.

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    <stdexcept> exists on Visual Studio 7.0.9955, so i would not mind

Similar Threads

  1. Exception every time I try to move stuff
    By cpury in forum Novashell Game Creation System
    Replies: 9
    Last Post: 03-01-2007, 11:26 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •