Mentions légales du service

Skip to content
Snippets Groups Projects

Improve exemple in canonical form notebook with some debug traces

1 file
+ 4
3
Compare changes
  • Side-by-side
  • Inline
// Dynamic allocation here just to be able to make our point due to the explicit call of destructor with `delete`
// Dynamic allocation here just to be able to make our point due to the explicit call of destructor with `delete`
Vector2* v1 = new Vector2(3., 5., 7.);
Vector2* v1 = new Vector2(3., 5., 7.);
Vector2* v2 = new Vector2(-4., -16., 0.);
Vector2* v2 = new Vector2(-4., -16., 0.);
v2 = v1;
v2 = v1;
std::cout << "Copy done" << std::endl;
std::cout << "Delete v1 @ " << std::hex << v1 << std::endl;
delete v1;
delete v1;
std::cout << "v1 deleted" << std::endl;
// delete v2; // Uncommenting this line leads to a kernel crash...
std::cout << "Delete v2 @ " << std::hex << v2 << std::endl;
 
delete v2; // WARNING: Comment this line for not kernel to crash
}
}
Loading