[ create a new paste ] login | about

Link: http://codepad.org/6DYZiU9c    [ raw code | output | fork ]

Niels - C++, pasted on Jul 29:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <exception>
#include <cassert>
#include <cstring>

class user_exception: public std::exception
{
  const char* what() const throw()
  {
    return "user exception";
  }
};

int main() {
  using namespace std;
  const exception& rhs = user_exception();
  exception lhs = rhs;
  assert( strcmp(lhs.what(), rhs.what()) == 0 );
}


Output:
1
2
3
t: t.cpp:18: int main(): Assertion `strcmp(lhs.what(), rhs.what()) == 0' failed.

Disallowed system call: SYS_kill


Create a new paste based on this one


Comments: