- I'm a junior C programmer.I don't understand the restrict keyword.Can you simply explain?Thanks for help.
Asked
Active
Viewed 28 times
-2

Krasnyy
- 1
- 4
-
`* restrict p`: Access to data pointed by `p` only occurs because of `p` or values derived from `p`. Is that simply enough? – chux - Reinstate Monica Mar 15 '19 at 22:18
-
If you can access this site then you can also access Google. – machine_1 Mar 15 '19 at 22:35
1 Answers
0
The restrict keyword basically says the pointer is not overlapping with the other one (you need to have 2 pointers for this to work), that way the compiler can skip some checks and optimize your code better.

Jiří Velek
- 153
- 2
- 12
-
1Do not need 2 pointers although that is certainly one way to see the usefulness of `restrict`. – chux - Reinstate Monica Mar 15 '19 at 22:27