</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt10ch23s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 23. Interacting with C"><div class="titlepage"><div><div><h2 class="title"><a id="manual.numerics.c"></a>Chapter 23. Interacting with C</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="numerics_and_c.html#numerics.c.array">Numerics vs. Arrays</a></span></dt><dt><span class="sect1"><a href="bk01pt10ch23s02.html">C99</a></span></dt></dl></div><div class="sect1" title="Numerics vs. Arrays"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="numerics.c.array"></a>Numerics vs. Arrays</h2></div></div></div><p>One of the major reasons why FORTRAN can chew through numbers so well
7
is that it is defined to be free of pointer aliasing, an assumption
8
that C89 is not allowed to make, and neither is C++98. C99 adds a new
9
keyword, <code class="code">restrict</code>, to apply to individual pointers. The
10
C++ solution is contained in the library rather than the language
11
(although many vendors can be expected to add this to their compilers
12
as an extension).
13
</p><p>That library solution is a set of two classes, five template classes,
14
and "a whole bunch" of functions. The classes are required
15
to be free of pointer aliasing, so compilers can optimize the
16
daylights out of them the same way that they have been for FORTRAN.
17
They are collectively called <code class="code">valarray</code>, although strictly
18
speaking this is only one of the five template classes, and they are
19
designed to be familiar to people who have worked with the BLAS