In short, restrict
is supposed to tell the compiler that the pointers cannot point into the same memory location. Which is very useful for, say, function arguments and further compiler optimization. In scientific computing, restrict
is very widely used.
Currently, restrict
keyword is only a part of C99, but not a part of C++. We know that a lot of C++ compilers support __restrict__
as an extension. This question also talks in detail about what restrict
and __restrict__
do.
Now, the discussion in the aforementioned question happened a long time ago and does not talk about C++17, C++20, nor plans for future standards. I found n3988 proposal that discusses restrict
-like aliases in C++, complexities with richer syntaxis in C++, and potential remedies.
According to the IBM blog (2014), n3988 was encouraged for future work.
This question talks about the history of restrict
and C++ without anything conclusive regarding the actual implementation and mentions the papers I already listed or the one mentioned in the comments (p1296).
I was not able to find anything beyond that on the plans of supporting restrict
in the upcoming C++ (as far as I know, it's not a part of C++17). It seems like a very useful functionality, so I wonder
- if I missed something in terms of proposals/discussion?
- is there other information on the
restrict
usage in C++? - are there alternative ways to make the compiler optimizations (allowed by
__restrict__
) possible by using only "standard" functionality?