我曾经被告知的一切都是去邪恶是邪恶的,远离他们,但我认为他们可以在这里帮助我(?).我想为用户提供一个选项,当捕获到异常并且无法解决该问题时会重新启动应用程序...
Everything I have ever been told is that go to's are evil and stay away from them, but I think they may help me here (?). I would like to provide the user an option to restart the application when an exception is caught and am having a bit of trouble wrapping my head around what to do...
我的应用程序将受到另一个进程的监视,但是在某些情况下,我希望用户能够决定要做什么而不将控制权返回给调用进程.
My application will be monitored by another process, but there are some exceptions where I want to the user to be able to decide what to do without returning control to the calling process.
像这样的可接受的"东西吗?还有其他建议吗?
Is something like this "acceptable"? Any other suggestions?
非常感谢!
int main(){ initialize: try{ //do things } catch(...) { cout<<"Would you like to try initializing again?"<<endl; //if yes goto initialize; //if not abort(); //or something... } return 0; }推荐答案
为什么不喜欢这个?
while(true){ //Do stuff if(exit){ break; } }或
continue = true; do{ //Do stuff if(exit){ continue = false; } }while(continue);更多推荐
是否可以使用“转到"从声明中
发布评论