In the world of C99, a new monster has started to rear its ugly head - the keyword &quot;restrict&quot;.<br><br>The idea is that in a conventional function, declared<br><br>&nbsp;void f(int *p, int *q);<br><br>the data pointed to by p /might/ overlap the data pointed to by q, wheras, if the function were declared as one of:
<br><br>&nbsp;void f(int * restrict p, int *q);<br>&nbsp;void f(int *p, int * restrict q);<br>&nbsp;void f(int * restrict p, int * restrict q);<br><br>then the data pointed to by p and q may /not/ overlap. The idea behind this is that the compiler can make better optimizations if it knows that. The problem is that now, in addition to const-correctness and volatile-correctness, you&#39;ve now also got restrict-correctness to worry about. All your library function prototypes now need to change - strcpy(), strcat(), memcpy() (but not memmove()) just for starters!
<br><br>The thing is, the /intent/ is well-meaning. It&#39;s the implementation that&#39;s attrocious.<br><br>One day, someone&#39;s going to suggest this for D. So, now that we&#39;ve got the const debate going in another thread, let&#39;s get this over with now, while the const debate is still fermenting.
<br><br>Here&#39;s what I suggest. First, restrict shall be assumed by default!<br><br>&nbsp;void f(int p[], int q[])<br>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp; /* compiler may assume that no pointers passed as function parameters overlap */<br>&nbsp;}<br><br>

If you want overlapping pointers, you must instead do this:<br><br>&nbsp;void overlap f(int p[], int q[])<br>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp; /* compiler must assume that all pointers passed as function parameters may overlap */<br>&nbsp;}<br><br>Yes, you lose some granularity. And yes, some existing code will develop undefined behavior until their prototypes are fixed. But /most/ functions won&#39;t need &quot;norestrict&quot;, and so fixing those that do is likely to be the least-work option.
<br><br>