是否可以使用“转到"从声明中

编程入门 行业动态 更新时间:2024-10-21 19:53:36
本文介绍了是否可以使用“转到"从声明中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我曾经被告知的一切都是去邪恶是邪恶的,远离他们,但我认为他们可以在这里帮助我(?).我想为用户提供一个选项,当捕获到异常并且无法解决该问题时会重新启动应用程序...

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);

更多推荐

是否可以使用“转到"从声明中

本文发布于:2023-11-09 05:49:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571544.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转到   可以使用   声明   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!