Il y a quelques min­utes encore, étu­di­ant le code con­tenu dans color_yuv2rgb.c dans xawtv, je ne con­nais­sais pas ce mot-clé du lan­gage C (défini dans la norme C99). Je suis alors tombé sur ce site qui ma fait sourire. L’auteur a rédigé le “con­trat” du mot-clé “restrict” pour vul­gariser son utilité:

THE RESTRICT CONTRACT

I, [insert your name], a PROFESSIONAL or AMATEUR [cir­cle one] pro­gram­mer rec­og­nize that there are lim­its to what a com­piler can do. I cer­tify that, to the best of my knowl­edge, there are no magic elves or mon­keys in the com­piler which through the forces of fairy dust can always make code faster. I under­stand that there are some prob­lems for which there is not enough infor­ma­tion to solve. I hereby declare that given the oppor­tu­nity to pro­vide the com­piler with suf­fi­cient infor­ma­tion, per­haps through some key word, I will gladly use said key­word and not bitch and moan about how “the com­piler should be doing this for me.”

In this case, I promise that the pointer declared along with the restrict qual­i­fier is not aliased. I cer­tify that writes through this pointer will not effect the val­ues read through any other pointer avail­able in the same con­text which is also declared as restricted.

* Your agree­ment to this con­tract is implied by use of the restrict keyword ;)”

Restrict Keyword