gpt4 book ai didi

C++ 编译时纯度​​检查?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:40:54 24 4
gpt4 key购买 nike

是否可以在 C++ 中指定编译时“纯度”检查?

即:

this function does not read from anything other than it's arguments
this function does not write to anything; it only returns the return value

最佳答案

const-correctness和高编译器警告级别应该做很多你要求的事情。还为编译器指定了一种非常严格的现代 C++ 方言(当您使用不符合要求的第三方库和代码时,这会让您非常恼火)

如果没有,那么那里有大量的静态分析工具,一些是开源的,一些是昂贵的,比如 Coverity、Parasoft C++Test 等等。

关于C++ 编译时纯度​​检查?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2458372/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com