首页> 外文期刊>Science of Computer Programming >To use or not to use the goto statement: Programming styles viewed from Hoare Logic
【24h】

To use or not to use the goto statement: Programming styles viewed from Hoare Logic

机译:使用或不使用goto语句:从Hoare Logic查看编程样式

获取原文
获取原文并翻译 | 示例

摘要

There has been a vast amount of debate on the goto issue: i.e., the issue whether to use or not to use the goto statement initiated by Dijkstra in his famous Letter to the Editor of CACM and his proposal of 'Structured Programming'. However, except for the goto-less programming style by Mills based on theoretical results on the expressibility of control flow diagrams, there have hardly been any scientific accounts on this issue from Dijkstra's own viewpoint of the correctness of programs. In this work, we reconsider this seemingly old-tired issue from the viewpoint of Hoare Logic, the most well-known framework for correctness proof of programs. We show that, in two cases, the with-goto programming styles are more suitable for proving correctness in Hoare Logic than the corresponding without-goto ones; that is, in each of two cases, the without-goto style requires more complicated assertions in the proof-outline than the with-goto one. The first case is on the use of the goto statement for escaping from nested loops and the second case is on the use of the goto statement for expressing state transitions in programming through the finite state machine model. Hence, in both cases, the use of the goto statement can be justified from the viewpoint of the correctness proof in Hoare Logic.
机译:关于goto问题存在大量争论:即是否使用Dijkstra在其给CACM编辑的著名信中以及他的``结构化编程''提案中提出的goto语句的问题。但是,除了Mills基于控制流程图的可表达性的理论结果而采用的goto-less编程风格之外,从Dijkstra自己对程序正确性的观点来看,几乎没有关于该问题的科学解释。在这项工作中,我们从Hoare Logic(最著名的程序正确性证明框架)的角度重新考虑了这个看似陈旧的问题。我们证明,在两种情况下,“有意愿”编程风格比“无意识”编程风格更适合证明Hoare Logic中的正确性。也就是说,在两种情况中的每种情况下,与goto-goto风格相比,togo-goto风格在证明大纲中需要更复杂的断言。第一种情况是使用goto语句从嵌套循环中转义,第二种情况是使用goto语句在通过有限状态机模型进行编程时表示状态转换。因此,在两种情况下,从Hoare Logic中的正确性证明的角度来看,可以证明使用goto语句是合理的。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号