🎉 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
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.
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.
This is the syntax of exception handling in C++.
try
{
}
catch() // Derived class
{
}
catch()
{
}
catch()
{
}
This notation go from specific class to general situation.
try
{
}
catch() // Derived class
{
}
catch()
{
}
catch()
{
}
This notation go from specific class to general situation.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement