不带中断的 switch 语句的技术名称
有谁知道不带中断的 switch 语句的“技术名称”?
我翻阅了几本教材,并在网上搜索了很长一段时间,没有结果。
Does anyone know the "technical name" for a switch statement without breaks?
I have looked through several textbooks and searched online for quite a while with no results.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一个没有中断的 switch 语句(也没有循环,所以它不是达夫的设备),我只是调用一个跳转表。
可以肯定的是,这不是结构化编程常用的工具之一。
A switch statement with no breaks (and no loop, so it's not Duff's Device), I would just call a jump table.
Not one of the tools commonly used for structured programming, that's for sure.
当执行从一个 Case 子句继续到下一个 Case 子句时,称为“失败”。
执行会从案例 1 到案例“失败”,但不会从案例 2 到案例 3。这就是您要问的吗?
When execution continues from one Case clause to the next it's called "fall-through".
Execution will "fall through" from case 1 to case, but not from case 2 to case 3. Is this what you're asking?
跌倒了吗?
或者您正在谈论一个没有中断的特定 switch 语句,称为 Duff's Device?
Fall through?
Or are you talking about a specific switch statement with no breaks, called Duff's Device?