🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Exception handling problem

Started by
2 comments, last by Peter_APIIT 16 years, 3 months ago
I'm a bit new to programming for Linux so i was suprised that try..catch block didn't catch an exception that was trown when my code was trying to write something to the beginning of RAM. I only saw "SegmentationFault" as program output so i'm wondering how to handle segmentation faults in C++ on Linux. Thanks in advance.
ubuntu jaunty amd64
Advertisement
In C++ try/catch blocks are only guaranteed to catch C++ exceptions: exceptions thrown with the throw keyword. Segmentation faults are handled with POSIX signals on linux, in particular, SIGSEGV. For more information use man signal.
Thanks a lot. I just forgot about signals)))
ubuntu jaunty amd64
This is the syntax of exception handling in C++.

try
{
}
catch() // Derived class
{
}
catch()
{
}
catch()
{
}

This notation go from specific class to general situation.

This topic is closed to new replies.

Advertisement