To cleave DNA or RNA with a restriction enzyme.

A (standard) C and (nonstandard) C++ keyword implemented only on certain compilers, which most of us will probably never need to use.

One of the excuses given by die-hard FORTRAN programmers is that "FORTRAN does number crunching faster than C++". This is only partly true.

FORTRAN's prowess comes from the fact that certain matrix manipulation algorithms can be optimized to a high degree if it can be guaranteed that a value in area of memory wont be written over before it needs to be read from. The only way to guarantee this is to guarantee that areas of memory will never be "aliased" during the operation. In Standardese, no two lvalues can reference the same area of memory. You can also think of it as "each area of memory can never have more than one pointer to it at the same time". As it turns out, variables are non-alias-able by default in FORTRAN, but C and C++ had no way to guarantee this. The roles of "limitation" and "feature" have reversed themselves!

However, these algorithms were initially only practical when hardwired into specialized hardware of certain high-performace computers, such as certain models of Cray computers. This made the need for restricting aliasing a platform dependency.

So, the answer was for Cray and other supercomputer manufacturers to introduce a nonstandard storage qualifier guaranteeing no aliasing into their C and C++ compilers, specified by the nonstandard keyword restrict. restrict is in the same class of keywords as const and volatile but can only be applied to pointers.

Theoretically, then, a matrix multiplication routine like

void mamul (double *restrict a, double * restrict b, double restrict *c, int m, int n, int p);

could be forwarded to the specialized hardware for high-performance number crunching (actually, I have no idea if matrix multiplication is one of the highly optimizable algorithms; it's just a guess on my part).

Of course any algorithm that can be implemented in hardware can be implemented in software, and the idea of preventing aliasing spread beyond the supercomputer world. restrict was codified into the C9X standard for C, and appears as a nonstandard extension of many C++ compilers.

See also

Re*strict" (?), a. [L. restrictus, p. p. of restringere. See Restrain.]




© Webster 1913.

Re*strict", v. t. [imp. & p. p. Restricted; p. pr. & vb. n. Restricting.]

To restrain within bounds; to limit; to confine; as, to restrict worlds to a particular meaning; to restrict a patient to a certain diet.

Syn. -- To limit; bound; circumscribe; restrain; repress; curb; coerce.


© Webster 1913.

Log in or register to write something here or to contact authors.