[英]ADA - pre and post conditions not working?
我正在尝试根据自己的 ada 前后条件进行学习。
If using GNAT (which looks like it's the default for jdoodle), you need to enable assertions.如果使用 GNAT(看起来它是 jdoodle 的默认设置),则需要启用断言。 Add
-gnata
as a command line parameter.添加
-gnata
作为命令行参数。
EDIT: I don't know much about jdoodle, but it seems it can't take arguments to the compiler, only when running your program...编辑:我对 jdoodle 了解不多,但它似乎不能将参数传递给编译器,只有在运行程序时...
Instead, you could add a pragma Assertion_Policy
to your program, like this:相反,您可以在程序中添加
pragma Assertion_Policy
,如下所示:
procedure Tp2q4 is
pragma Assertion_Policy(Check);
--...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.