关于c语言中_restrict

休息了一个月,今天上班各种不适应。

   看到一个函数定义  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.

 

   还是没看懂到底有什么意义。本人初学确实不懂

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值