do {...} while(false) [英] do {...} while(false)

查看:165
本文介绍了do {...} while(false)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在看个人的代码,注意到他的功能似乎有一个模式:

I was looking at some code by an individual and noticed he seems to have a pattern in his functions:

<return-type> function(<params>)
{
 <initialization>

 do
 {
   <main code for function>
 }
 while(false);

 <tidy-up & return>
}

这不是,更奇特代码是相当整洁,不足为奇)。这不是我以前见过的,我想知道是否有人可以想到任何逻辑背后 - 背景在不同的语言也许?

It's not bad, more peculiar (the actual code is fairly neat and unsurprising). It's not something I've seen before and I wondered if anyone can think of any logic behind it - background in a different language perhaps?

推荐答案

您可以打开 do {...} while(false)

这篇关于do {...} while(false)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆