C++ ignore/skip /jump/close exceptions

#include <iostream> 
 
void ignore_exceptions()
{
    for(int i=-10;i<10;i++)
    {
        std::cout<<"i:"<<i<<", 100/i="<<100/i<<std::endl;
    }     
    std::cout<<"Finished in "<<__FUNCTION__<<std::endl;
}

int main(int args, char **argv)
{
    ignore_exceptions();
    std::cout << "Finished in " << __FUNCTION__ << std::endl;
}
g++-12 -g -std=c++23 -I. main.cpp -o h1 -luuid  -fno-exceptions -fno-rtti;

 

posted @ 2023-09-15 18:20  FredGrit  阅读(15)  评论(0编辑  收藏  举报