blob: ef16affbcef829813cc07dcb7682a610826522ab [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2015 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below). A copy of the license is included in the section entitled
"GNU Free Documentation License".
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development. -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Using the GNU Compiler Collection (GCC): C++ Extensions</title>
<meta name="description" content="Using the GNU Compiler Collection (GCC): C++ Extensions">
<meta name="keywords" content="Using the GNU Compiler Collection (GCC): C++ Extensions">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="C_002b_002b-Volatiles.html#C_002b_002b-Volatiles" rel="next" title="C++ Volatiles">
<link href="Binary-constants.html#Binary-constants" rel="prev" title="Binary constants">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="C_002b_002b-Extensions"></a>
<div class="header">
<p>
Next: <a href="Objective_002dC.html#Objective_002dC" accesskey="n" rel="next">Objective-C</a>, Previous: <a href="C-Extensions.html#C-Extensions" accesskey="p" rel="prev">C Extensions</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Extensions-to-the-C_002b_002b-Language"></a>
<h2 class="chapter">7 Extensions to the C++ Language</h2>
<a name="index-extensions_002c-C_002b_002b-language"></a>
<a name="index-C_002b_002b-language-extensions"></a>
<p>The GNU compiler provides these extensions to the C++ language (and you
can also use most of the C language extensions in your C++ programs). If you
want to write code that checks whether these features are available, you can
test for the GNU compiler the same way as for C programs: check for a
predefined macro <code>__GNUC__</code>. You can also use <code>__GNUG__</code> to
test specifically for GNU C++ (see <a href="http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros">Predefined Macros</a> in <cite>The GNU C Preprocessor</cite>).
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="C_002b_002b-Volatiles.html#C_002b_002b-Volatiles" accesskey="1">C++ Volatiles</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">What constitutes an access to a volatile object.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Restricted-Pointers.html#Restricted-Pointers" accesskey="2">Restricted Pointers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">C99 restricted pointers and references.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Vague-Linkage.html#Vague-Linkage" accesskey="3">Vague Linkage</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Where G++ puts inlines, vtables and such.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="C_002b_002b-Interface.html#C_002b_002b-Interface" accesskey="4">C++ Interface</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">You can use a single C++ header file for both
declarations and definitions.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Template-Instantiation.html#Template-Instantiation" accesskey="5">Template Instantiation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Methods for ensuring that exactly one copy of
each needed template instantiation is emitted.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Bound-member-functions.html#Bound-member-functions" accesskey="6">Bound member functions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">You can extract a function pointer to the
method denoted by a &lsquo;<samp>-&gt;*</samp>&rsquo; or &lsquo;<samp>.*</samp>&rsquo; expression.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="C_002b_002b-Attributes.html#C_002b_002b-Attributes" accesskey="7">C++ Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Variable, function, and type attributes for C++ only.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Function-Multiversioning.html#Function-Multiversioning" accesskey="8">Function Multiversioning</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Declaring multiple function versions.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Namespace-Association.html#Namespace-Association" accesskey="9">Namespace Association</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Strong using-directives for namespace association.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Type-Traits.html#Type-Traits">Type Traits</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Compiler support for type traits
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Java-Exceptions.html#Java-Exceptions">Java Exceptions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Tweaking exception handling to work with Java.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Deprecated-Features.html#Deprecated-Features">Deprecated Features</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Things will disappear from G++.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Backwards-Compatibility.html#Backwards-Compatibility">Backwards Compatibility</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Compatibilities with earlier definitions of C++.
</td></tr>
</table>
<hr>
<div class="header">
<p>
Next: <a href="Objective_002dC.html#Objective_002dC" accesskey="n" rel="next">Objective-C</a>, Previous: <a href="C-Extensions.html#C-Extensions" accesskey="p" rel="prev">C Extensions</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>