英特尔 C++ 是否可以?编译器有边界检查吗?
我想知道,Intel C++ 编译器是否有可用的边界检查?十年来,我正在处理大量不断发展的代码,并且迫切需要调试和重构。我需要任何我能得到的帮助。
I was wondering, does Intel C++ compiler have bounds checking available? I am working with tons of code evolving for ten years now, and in desperate need for debugging and refactoring. I need any help I can get.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
英特尔的编译器有多个边界检查选项。例如
,检查指针、Qcheck-pointers 确定编译器是否通过指针检查内存访问的边界。
http://software.intel.com/sites/products/documentation/doclib/iss/2013/compiler/cpp-lin/GUID-35036DDA-62B4-402F-8A21-1201C2706BF3.htm
Intel's compiler has several bounds checking options. E.g.
check-pointers, Qcheck-pointers Determines whether the compiler checks bounds for memory access through pointers.
http://software.intel.com/sites/products/documentation/doclib/iss/2013/compiler/cpp-lin/GUID-35036DDA-62B4-402F-8A21-1201C2706BF3.htm
C 数组从根本上就是这样被破坏的,你无法可靠地对它们进行边界检查。编译器也不能。然而,Intel 的 C++ 编译器当然可以编译向量类。打开迭代器调试,使用 at() 访问器。
C arrays are fundamentally broken this way, you cannot reliably bounds-check them. Nor can the compiler. Intel's C++ compiler however certainly can compile the vector class. Turn on iterator debugging, use the at() accessor.
如果您使用的是 Linux 或 OS X,valgrind 可以帮助您查找与内存访问相关的错误。它不支持 C++,因此将其输出与您的代码相匹配可能需要一些工作。
If you are working on Linux or OS X, valgrind can help you find memory access related errors. It's not C++ aware, so matching its output with your code may take a little work.