goto のように try-catch を使用するのは悪い習慣ですか? たとえば、単純なコード
try{
if(argc<2){
std::cout<<"no inputfile"<<std::endl;
throw 1;
}
STARTUPINFO cif;
ZeroMemory(&cif,sizeof(STARTUPINFO));
PROCESS_INFORMATION pi;
if(FALSE==CreateProcess(argv[1],NULL,NULL,NULL,FALSE,NULL,NULL,NULL,
&cif,&pi)){
printf("smth is wrong");
throw 1;
}
WaitForSingleObject(pi.hProcess, INFINITE);
GetExitCodeProcess(pi.hProcess, &exitCode);
std::cout<<"Process return"<<exitCode<<std::endl;
throw 1;
}
catch(int a){
printf("press Enter");
getchar();
}