在Fortran中声明 [英] Assertions in Fortran

查看:229
本文介绍了在Fortran中声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Fortran有一个标准的函数/关键字等价于C assert 吗?



我找不到在Fortran2003标准中提到的 assert 。我发现如何使用预处理器的方法很少,但在本答案中,建议编写自己的断言。是否有可能在不使用预处理器的情况下创建这样的用户函数/子程序?



我预计这些断言在发布版本中被禁用。


在我看来,标准Fortran中没有这样的语句或函数/子例程。但是 - 正如您所说的 - 您可以在Fortran中使用自己的子例程/函数和/或OOP来实现此目标。有关此主题,请参阅Arjen Markus出色的

Does Fortran have a standard function/keyword equivalent for C assert?

I could not find assert mentioned in Fortran2003 standard I have. I have found few ways how to use pre-processor, but in this answer it is suggested to write own assertions. Is it possible to create such user function/subroutine without using pre-processor?

I expect that these assertions are disabled for release builds.

解决方案

To my knowledge, there is no such statement or function/subroutine in Standard Fortran. But - as you have said - you can use your own subroutines/function and/or OOP in Fortran to realize this goal. See Arjen Markus' excellent paper on this topic.

这篇关于在Fortran中声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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