can we compile without try/catch

can we compile without try/catch

#include #include #include #include "resource.h" #include "VideoStreamLib.h" #include #include "adpcppf.h" #include "ProxyLib/ProxyLib.h" const ApplicationId myApplicationID(0x0A7641EC,0x27CC499D,0x9B212F6F,0x8C2BC320); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { Application * myApplication = NULL; ApplicationId myApplicationId(0x0A7641EC,0x27CC499D,0x9B212F6F,0x8C2BC320); try { myApplication = new Application(myApplicationID); } catch (AdpException& e) { cout << "Caught exception in application: " << e.what() << endl; } //Application * myApplication = NULL; try { myApplication = new Application(myApplicationID); } catch (AdpException& e) { cout << "Caught exception in application: " << e.what() << endl; } after including try/catch block in main function am getting errors. Without Try/Catch , ISV is able to compile successfully. the following are three lines with no errors const ApplicationId myApplicationID(0x0A7641EC,0x27CC499D,0x9B212F6F,0x8C2BC320); Application * myApplication = NULL; ApplicationId myApplicationId(0x0A7641EC,0x27CC499D,0x9B212F6F,0x8C2BC320); so we need to know if we could compile without try/catch exception am i right?
2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Nagabhushan,

Please post the compiler errors and we will try to provide feedback.

There are no requirements to use try/catch in any particular code block. However to check the return code I would advise that you use the method shown in the examples.

Leave a Comment

Please sign in to add a comment. Not a member? Join today