Phone interview 2. Tell whether there is anything wrong with the code you see.
Anonymous
Here they wanted to check my knowledge of C++, I was not supposed to write anything. Usually it's some simple and easy to notice undefined behaviour, in my case the code was deleting the same pointer twice due to a missing copy constructor. The code was something like class Handle { int *p_; public: explicit Handle(int *p) : p_(p) { } ~Handle() { delete p_; } }; int main() { Handle a(new int(5)); Handle b = a; return 0; }
Check out your Company Bowl for anonymous work chats.