1 |
742 |
jeremybenn |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2 |
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3 |
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Interacting with C</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><meta name="keywords" content=" ISO C++ , library "/><meta name="keywords" content=" ISO C++ , runtime , library "/><link rel="home" href="../index.html" title="The GNU C++ Library"/><link rel="up" href="numerics.html" title="Chapter 12. Numerics"/><link rel="prev" href="generalized_numeric_operations.html" title="Generalized Operations"/><link rel="next" href="io.html" title="Chapter 13. Input and Output"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Interacting with C</th></tr><tr><td align="left"><a accesskey="p" href="generalized_numeric_operations.html">Prev</a> </td><th width="60%" align="center">Chapter 12.
|
4 |
|
|
Numerics
|
5 |
|
|
|
6 |
|
|
</th><td align="right"> <a accesskey="n" href="io.html">Next</a></td></tr></table><hr/></div><div class="section" title="Interacting with C"><div class="titlepage"><div><div><h2 class="title"><a id="std.numerics.c"/>Interacting with C</h2></div></div></div><div class="section" title="Numerics vs. Arrays"><div class="titlepage"><div><div><h3 class="title"><a id="numerics.c.array"/>Numerics vs. Arrays</h3></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
|
20 |
|
|
libraries before.
|
21 |
|
|
</p></div><div class="section" title="C99"><div class="titlepage"><div><div><h3 class="title"><a id="numerics.c.c99"/>C99</h3></div></div></div><p>In addition to the other topics on this page, we'll note here some
|
22 |
|
|
of the C99 features that appear in libstdc++.
|
23 |
|
|
</p><p>The C99 features depend on the <code class="code">--enable-c99</code> configure flag.
|
24 |
|
|
This flag is already on by default, but it can be disabled by the
|
25 |
|
|
user. Also, the configuration machinery will disable it if the
|
26 |
|
|
necessary support for C99 (e.g., header files) cannot be found.
|
27 |
|
|
</p><p>As of GCC 3.0, C99 support includes classification functions
|
28 |
|
|
such as <code class="code">isnormal</code>, <code class="code">isgreater</code>,
|
29 |
|
|
<code class="code">isnan</code>, etc.
|
30 |
|
|
The functions used for 'long long' support such as <code class="code">strtoll</code>
|
31 |
|
|
are supported, as is the <code class="code">lldiv_t</code> typedef. Also supported
|
32 |
|
|
are the wide character functions using 'long long', like
|
33 |
|
|
<code class="code">wcstoll</code>.
|
34 |
|
|
</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="generalized_numeric_operations.html">Prev</a> </td><td align="center"><a accesskey="u" href="numerics.html">Up</a></td><td align="right"> <a accesskey="n" href="io.html">Next</a></td></tr><tr><td align="left" valign="top">Generalized Operations </td><td align="center"><a accesskey="h" href="../index.html">Home</a></td><td align="right" valign="top"> Chapter 13.
|
35 |
|
|
Input and Output
|
36 |
|
|
|
37 |
|
|
</td></tr></table></div></body></html>
|