From a practical viewpoint, it's easy to see that C will always be with us, taking a place beside Fortran and Cobol as the right tool for certain jobs. - Larry O'Brien

the brown-dragon blog

'Restrict' yourself in C

2009-12-10

A new feature introduced in the C99 standard is the restrict qualifier.

restrict is a simple and useful qualifier. All it means is that (for the scope of the restrict-ed pointer declaration) no other pointer will access the data pointed to by this pointer.

Why would you do this? Well, it is supposed to act as a hint to compilers, allowing them to perform optimizations they could not otherwise do which is nice.

One caveat though: restrict is not in the C++ standard so only C programs are expected to use this keyword. (If you aren't sure of the difference between C and C++ read this post).

Other Posts

(ordered by Tags then Date)