aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/doc/html/manual/bk01pt02ch04s03.html
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/doc/html/manual/bk01pt02ch04s03.html')
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt02ch04s03.html29
1 files changed, 29 insertions, 0 deletions
diff --git a/libstdc++-v3/doc/html/manual/bk01pt02ch04s03.html b/libstdc++-v3/doc/html/manual/bk01pt02ch04s03.html
new file mode 100644
index 00000000000..fbfba430e22
--- /dev/null
+++ b/libstdc++-v3/doc/html/manual/bk01pt02ch04s03.html
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>NULL</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="bk01pt02ch04.html" title="Chapter 4. Types" /><link rel="prev" href="bk01pt02ch04s02.html" title="Numeric Properties" /><link rel="next" href="bk01pt02ch05.html" title="Chapter 5. Dynamic Memory" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">NULL</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt02ch04s02.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Types</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt02ch05.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.support.types.null"></a>NULL</h2></div></div></div><p>
+ The only change that might affect people is the type of
+ <code class="constant">NULL</code>: while it is required to be a macro,
+ the definition of that macro is <span class="emphasis"><em>not</em></span> allowed
+ to be <code class="constant">(void*)0</code>, which is often used in C.
+ </p><p>
+ For <span class="command"><strong>g++</strong></span>, <code class="constant">NULL</code> is
+ </p><pre class="programlisting">#define</pre><p>'d to be
+ <code class="constant">__null</code>, a magic keyword extension of
+ <span class="command"><strong>g++</strong></span>.
+ </p><p>
+ The biggest problem of #defining <code class="constant">NULL</code> to be
+ something like “<span class="quote">0L</span>” is that the compiler will view
+ that as a long integer before it views it as a pointer, so
+ overloading won't do what you expect. (This is why
+ <span class="command"><strong>g++</strong></span> has a magic extension, so that
+ <code class="constant">NULL</code> is always a pointer.)
+ </p><p>In his book <a class="ulink" href="http://www.awprofessional.com/titles/0-201-92488-9/" target="_top"><span class="emphasis"><em>Effective
+ C++</em></span></a>, Scott Meyers points out that the best way
+ to solve this problem is to not overload on pointer-vs-integer
+ types to begin with. He also offers a way to make your own magic
+ <code class="constant">NULL</code> that will match pointers before it
+ matches integers.
+ </p><p>See
+ <a class="ulink" href="http://www.awprofessional.com/titles/0-201-31015-5/" target="_top">the
+ Effective C++ CD example</a>
+ </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt02ch04s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk01pt02ch04.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt02ch05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Numeric Properties </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 5. Dynamic Memory</td></tr></table></div></body></html>