What can human beings make out of the restrict qualifier?

后端 未结 6 1444
盖世英雄少女心
盖世英雄少女心 2021-02-04 05:51

If I got the C99 restrict keyword right, qualifying a pointer with it is a promise made that the data it references won\'t be modified behind the compiler\'s back t

6条回答
  •  时光取名叫无心
    2021-02-04 06:53

    The best 'intuition' to have about the restrict keyword is that its a guarantee (by the programmer to the compiler) that, for the lifetime of the pointer, memory accessed via that pointer will ONLY be accessed via that pointer and not via another pointer or reference or global address. So its important that its on a pointer as its a property of both the pointer and the memory, tying the two together until the pointer goes out of scope.

提交回复
热议问题