休息了一个月,今天上班各种不适应。
看到一个函数定义 char *ecvt(double value, int ndigit, int *__restrict decpt, int*__restrict sign);
觉得 那个 __restrict 太怪了
后来查了一下资料
资料:http://msdn.microsoft.com/zh-cn/library/5ft82fed
Like the restrict __declspec modifier, the __restrict keyword indicates that a symbol is not aliased in the current scope. The __restrict keyword differs from the restrict __declspec modifier in the following ways:
-
The __restrict keyword is valid only on variables, and __declspec(restrict) is only valid on function declarations and definitions.
-
When __restrict is used, the compiler will not propagate the no-alias property of a variable. That is, if you assign a __restrict variable to a non-__restrict variable, the compiler will not imply that the non-__restrict variable is not aliased. This is different from the behavior of the restrict keyword from the C99 specification.
Generally, if you affect the behavior of an entire function, it is better to use the __declspec than the keyword.
__restrict is similar to restrict from the C99 spec, but __restrict can be used in C++ or C programs.
还是没看懂到底有什么意义。本人初学确实不懂