diff options
author | alk3pInjection <webmaster@raspii.tech> | 2024-02-04 16:16:35 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2024-02-04 16:16:35 +0800 |
commit | abdaadbcae30fe0c9a66c7516798279fdfd97750 (patch) | |
tree | 00a54a6e25601e43876d03c1a4a12a749d4a914c /share/doc/gcc/C_002b_002b-Interface.html |
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
Change-Id: I7303388733328cd98ab9aa3c30236db67f2e9e9c
Diffstat (limited to 'share/doc/gcc/C_002b_002b-Interface.html')
-rw-r--r-- | share/doc/gcc/C_002b_002b-Interface.html | 189 |
1 files changed, 189 insertions, 0 deletions
diff --git a/share/doc/gcc/C_002b_002b-Interface.html b/share/doc/gcc/C_002b_002b-Interface.html new file mode 100644 index 0000000..1807ae2 --- /dev/null +++ b/share/doc/gcc/C_002b_002b-Interface.html @@ -0,0 +1,189 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- This file documents the use of the GNU compilers. + +Copyright (C) 1988-2023 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.1, http://www.gnu.org/software/texinfo/ --> +<head> +<title>Using the GNU Compiler Collection (GCC): C++ Interface</title> + +<meta name="description" content="Using the GNU Compiler Collection (GCC): C++ Interface"> +<meta name="keywords" content="Using the GNU Compiler Collection (GCC): C++ Interface"> +<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="Indices.html#Indices" rel="index" title="Indices"> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> +<link href="C_002b_002b-Extensions.html#C_002b_002b-Extensions" rel="up" title="C++ Extensions"> +<link href="Template-Instantiation.html#Template-Instantiation" rel="next" title="Template Instantiation"> +<link href="Vague-Linkage.html#Vague-Linkage" rel="previous" title="Vague Linkage"> +<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_US" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> +<a name="C_002b_002b-Interface"></a> +<div class="header"> +<p> +Next: <a href="Template-Instantiation.html#Template-Instantiation" accesskey="n" rel="next">Template Instantiation</a>, Previous: <a href="Vague-Linkage.html#Vague-Linkage" accesskey="p" rel="previous">Vague Linkage</a>, Up: <a href="C_002b_002b-Extensions.html#C_002b_002b-Extensions" accesskey="u" rel="up">C++ Extensions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p> +</div> +<hr> +<a name="C_002b_002b-Interface-and-Implementation-Pragmas"></a> +<h3 class="section">7.4 C++ Interface and Implementation Pragmas</h3> + +<a name="index-interface-and-implementation-headers_002c-C_002b_002b"></a> +<a name="index-C_002b_002b-interface-and-implementation-headers"></a> +<a name="index-pragmas_002c-interface-and-implementation"></a> + +<p><code>#pragma interface</code> and <code>#pragma implementation</code> provide the +user with a way of explicitly directing the compiler to emit entities +with vague linkage (and debugging information) in a particular +translation unit. +</p> +<p><em>Note:</em> These <code>#pragma</code>s have been superceded as of GCC 2.7.2 +by COMDAT support and the “key method” heuristic +mentioned in <a href="Vague-Linkage.html#Vague-Linkage">Vague Linkage</a>. Using them can actually cause your +program to grow due to unnecessary out-of-line copies of inline +functions. +</p> +<dl compact="compact"> +<dd><a name="index-_0023pragma-interface"></a> +</dd> +<dt><code>#pragma interface</code></dt> +<dt><code>#pragma interface "<var>subdir</var>/<var>objects</var>.h"</code></dt> +<dd><p>Use this directive in <em>header files</em> that define object classes, to save +space in most of the object files that use those classes. Normally, +local copies of certain information (backup copies of inline member +functions, debugging information, and the internal tables that implement +virtual functions) must be kept in each object file that includes class +definitions. You can use this pragma to avoid such duplication. When a +header file containing ‘<samp>#pragma interface</samp>’ is included in a +compilation, this auxiliary information is not generated (unless +the main input source file itself uses ‘<samp>#pragma implementation</samp>’). +Instead, the object files contain references to be resolved at link +time. +</p> +<p>The second form of this directive is useful for the case where you have +multiple headers with the same name in different directories. If you +use this form, you must specify the same string to ‘<samp>#pragma +implementation</samp>’. +</p> +<a name="index-_0023pragma-implementation"></a> +</dd> +<dt><code>#pragma implementation</code></dt> +<dt><code>#pragma implementation "<var>objects</var>.h"</code></dt> +<dd><p>Use this pragma in a <em>main input file</em>, when you want full output from +included header files to be generated (and made globally visible). The +included header file, in turn, should use ‘<samp>#pragma interface</samp>’. +Backup copies of inline member functions, debugging information, and the +internal tables used to implement virtual functions are all generated in +implementation files. +</p> +<a name="index-implied-_0023pragma-implementation"></a> +<a name="index-_0023pragma-implementation_002c-implied"></a> +<a name="index-naming-convention_002c-implementation-headers"></a> +<p>If you use ‘<samp>#pragma implementation</samp>’ with no argument, it applies to +an include file with the same basename<a name="DOCF8" href="#FOOT8"><sup>8</sup></a> as your source +file. For example, in <samp>allclass.cc</samp>, giving just +‘<samp>#pragma implementation</samp>’ +by itself is equivalent to ‘<samp>#pragma implementation "allclass.h"</samp>’. +</p> +<p>Use the string argument if you want a single implementation file to +include code from multiple header files. (You must also use +‘<samp>#include</samp>’ to include the header file; ‘<samp>#pragma +implementation</samp>’ only specifies how to use the file—it doesn’t actually +include it.) +</p> +<p>There is no way to split up the contents of a single header file into +multiple implementation files. +</p></dd> +</dl> + +<a name="index-inlining-and-C_002b_002b-pragmas"></a> +<a name="index-C_002b_002b-pragmas_002c-effect-on-inlining"></a> +<a name="index-pragmas-in-C_002b_002b_002c-effect-on-inlining"></a> +<p>‘<samp>#pragma implementation</samp>’ and ‘<samp>#pragma interface</samp>’ also have an +effect on function inlining. +</p> +<p>If you define a class in a header file marked with ‘<samp>#pragma +interface</samp>’, the effect on an inline function defined in that class is +similar to an explicit <code>extern</code> declaration—the compiler emits +no code at all to define an independent version of the function. Its +definition is used only for inlining with its callers. +</p> +<a name="index-fno_002dimplement_002dinlines-1"></a> +<p>Conversely, when you include the same header file in a main source file +that declares it as ‘<samp>#pragma implementation</samp>’, the compiler emits +code for the function itself; this defines a version of the function +that can be found via pointers (or by callers compiled without +inlining). If all calls to the function can be inlined, you can avoid +emitting the function by compiling with <samp>-fno-implement-inlines</samp>. +If any calls are not inlined, you will get linker errors. +</p> +<div class="footnote"> +<hr> +<h4 class="footnotes-heading">Footnotes</h4> + +<h3><a name="FOOT8" href="#DOCF8">(8)</a></h3> +<p>A file’s <em>basename</em> +is the name stripped of all leading path information and of trailing +suffixes, such as ‘<samp>.h</samp>’ or ‘<samp>.C</samp>’ or ‘<samp>.cc</samp>’.</p> +</div> +<hr> +<div class="header"> +<p> +Next: <a href="Template-Instantiation.html#Template-Instantiation" accesskey="n" rel="next">Template Instantiation</a>, Previous: <a href="Vague-Linkage.html#Vague-Linkage" accesskey="p" rel="previous">Vague Linkage</a>, Up: <a href="C_002b_002b-Extensions.html#C_002b_002b-Extensions" accesskey="u" rel="up">C++ Extensions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p> +</div> + + + +</body> +</html> |