Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

3 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Variable Attributes (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="Variable Attributes (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="Variable Attributes (Using the GNU Compiler Collection (GCC))">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="C-Extensions.html#C-Extensions" rel="up" title="C Extensions">
  30. <link href="Common-Variable-Attributes.html#Common-Variable-Attributes" rel="next" title="Common Variable Attributes">
  31. <link href="Xstormy16-Function-Attributes.html#Xstormy16-Function-Attributes" rel="prev" title="Xstormy16 Function Attributes">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Variable-Attributes"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Type-Attributes.html#Type-Attributes" accesskey="n" rel="next">Type Attributes</a>, Previous: <a href="Function-Attributes.html#Function-Attributes" accesskey="p" rel="prev">Function Attributes</a>, Up: <a href="C-Extensions.html#C-Extensions" accesskey="u" rel="up">C Extensions</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>
  65. </div>
  66. <hr>
  67. <a name="Specifying-Attributes-of-Variables"></a>
  68. <h3 class="section">6.34 Specifying Attributes of Variables</h3>
  69. <a name="index-attribute-of-variables"></a>
  70. <a name="index-variable-attributes"></a>
  71. <p>The keyword <code>__attribute__</code> allows you to specify special properties
  72. of variables, function parameters, or structure, union, and, in C++, class
  73. members. This <code>__attribute__</code> keyword is followed by an attribute
  74. specification enclosed in double parentheses. Some attributes are currently
  75. defined generically for variables. Other attributes are defined for
  76. variables on particular target systems. Other attributes are available
  77. for functions (see <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>), labels (see <a href="Label-Attributes.html#Label-Attributes">Label Attributes</a>),
  78. enumerators (see <a href="Enumerator-Attributes.html#Enumerator-Attributes">Enumerator Attributes</a>), statements
  79. (see <a href="Statement-Attributes.html#Statement-Attributes">Statement Attributes</a>), and for types (see <a href="Type-Attributes.html#Type-Attributes">Type Attributes</a>).
  80. Other front ends might define more attributes
  81. (see <a href="C_002b_002b-Extensions.html#C_002b_002b-Extensions">Extensions to the C++ Language</a>).
  82. </p>
  83. <p>See <a href="Attribute-Syntax.html#Attribute-Syntax">Attribute Syntax</a>, for details of the exact syntax for using
  84. attributes.
  85. </p>
  86. <table class="menu" border="0" cellspacing="0">
  87. <tr><td align="left" valign="top">&bull; <a href="Common-Variable-Attributes.html#Common-Variable-Attributes" accesskey="1">Common Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  88. </td></tr>
  89. <tr><td align="left" valign="top">&bull; <a href="ARC-Variable-Attributes.html#ARC-Variable-Attributes" accesskey="2">ARC Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  90. </td></tr>
  91. <tr><td align="left" valign="top">&bull; <a href="AVR-Variable-Attributes.html#AVR-Variable-Attributes" accesskey="3">AVR Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  92. </td></tr>
  93. <tr><td align="left" valign="top">&bull; <a href="Blackfin-Variable-Attributes.html#Blackfin-Variable-Attributes" accesskey="4">Blackfin Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  94. </td></tr>
  95. <tr><td align="left" valign="top">&bull; <a href="H8_002f300-Variable-Attributes.html#H8_002f300-Variable-Attributes" accesskey="5">H8/300 Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  96. </td></tr>
  97. <tr><td align="left" valign="top">&bull; <a href="IA_002d64-Variable-Attributes.html#IA_002d64-Variable-Attributes" accesskey="6">IA-64 Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  98. </td></tr>
  99. <tr><td align="left" valign="top">&bull; <a href="M32R_002fD-Variable-Attributes.html#M32R_002fD-Variable-Attributes" accesskey="7">M32R/D Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  100. </td></tr>
  101. <tr><td align="left" valign="top">&bull; <a href="MeP-Variable-Attributes.html#MeP-Variable-Attributes" accesskey="8">MeP Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  102. </td></tr>
  103. <tr><td align="left" valign="top">&bull; <a href="Microsoft-Windows-Variable-Attributes.html#Microsoft-Windows-Variable-Attributes" accesskey="9">Microsoft Windows Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  104. </td></tr>
  105. <tr><td align="left" valign="top">&bull; <a href="MSP430-Variable-Attributes.html#MSP430-Variable-Attributes">MSP430 Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  106. </td></tr>
  107. <tr><td align="left" valign="top">&bull; <a href="Nvidia-PTX-Variable-Attributes.html#Nvidia-PTX-Variable-Attributes">Nvidia PTX Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  108. </td></tr>
  109. <tr><td align="left" valign="top">&bull; <a href="PowerPC-Variable-Attributes.html#PowerPC-Variable-Attributes">PowerPC Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  110. </td></tr>
  111. <tr><td align="left" valign="top">&bull; <a href="RL78-Variable-Attributes.html#RL78-Variable-Attributes">RL78 Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  112. </td></tr>
  113. <tr><td align="left" valign="top">&bull; <a href="V850-Variable-Attributes.html#V850-Variable-Attributes">V850 Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  114. </td></tr>
  115. <tr><td align="left" valign="top">&bull; <a href="x86-Variable-Attributes.html#x86-Variable-Attributes">x86 Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  116. </td></tr>
  117. <tr><td align="left" valign="top">&bull; <a href="Xstormy16-Variable-Attributes.html#Xstormy16-Variable-Attributes">Xstormy16 Variable Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  118. </td></tr>
  119. </table>
  120. <hr>
  121. <div class="header">
  122. <p>
  123. Next: <a href="Type-Attributes.html#Type-Attributes" accesskey="n" rel="next">Type Attributes</a>, Previous: <a href="Function-Attributes.html#Function-Attributes" accesskey="p" rel="prev">Function Attributes</a>, Up: <a href="C-Extensions.html#C-Extensions" accesskey="u" rel="up">C Extensions</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>
  124. </div>
  125. </body>
  126. </html>