C ++ 11是否添加C99限制说明符?如果没有,为什么不呢?
收藏

restrict is a C99 feature which is getting a lot of attention lately by allowing the compiler to perform "previously-fortran-only" optimizations to pointers. It's also the same keyword announced by Microsoft recently to be the underpinnings of the C++AMP specification.

该关键字实际上在FCD中吗?如果不是,是否有特定的原因被忽略?

最佳答案

One argument is that C needs restrict more than C++, because many operations are done with pointers to primitive types and therefore C code has more aliasing problems than C++.

别名规则说,指向不同类型的指针不能别名,因此,如果指向函数的参数具有不同的类类型,则它们不能重叠。

In C++ we also have the valarray family of classes that are supposed to handle arrays of primitive types that are not allowed to alias. Not that it is used much...

添加另一种解决某些混叠问题的方法,显然并没有使委员会感到兴奋。

    公众号
    关注公众号订阅更多技术干货!