Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / info / stabs / Negative-Type-Numbers.html
blob0ef644325cf01314ca8bb661f6464f9d64696eaa
1 <html lang="en">
2 <head>
3 <title>STABS</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="STABS">
6 <meta name="generator" content="makeinfo 4.3">
7 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="Negative%20Type%20Numbers">Negative Type Numbers</a>,
13 Previous:<a rel="previous" accesskey="p" href="Builtin-Type-Descriptors.html#Builtin%20Type%20Descriptors">Builtin Type Descriptors</a>,
14 Up:<a rel="up" accesskey="u" href="Builtin-Types.html#Builtin%20Types">Builtin Types</a>
15 <hr><br>
16 </div>
18 <h4 class="subsection">Negative Type Numbers</h4>
20 <p>This is the method used in XCOFF for defining builtin types.
21 Since the debugger knows about the builtin types anyway, the idea of
22 negative type numbers is simply to give a special type number which
23 indicates the builtin type. There is no stab defining these types.
25 <p>There are several subtle issues with negative type numbers.
27 <p>One is the size of the type. A builtin type (for example the C types
28 <code>int</code> or <code>long</code>) might have different sizes depending on
29 compiler options, the target architecture, the ABI, etc. This issue
30 doesn't come up for IBM tools since (so far) they just target the
31 RS/6000; the sizes indicated below for each size are what the IBM
32 RS/6000 tools use. To deal with differing sizes, either define separate
33 negative type numbers for each size (which works but requires changing
34 the debugger, and, unless you get both AIX dbx and GDB to accept the
35 change, introduces an incompatibility), or use a type attribute
36 (see <a href="String-Field.html#String%20Field">String Field</a>) to define a new type with the appropriate size
37 (which merely requires a debugger which understands type attributes,
38 like AIX dbx or GDB). For example,
40 <pre class="example"> .stabs "boolean:t10=@s8;-16",128,0,0,0
41 </pre>
43 <p>defines an 8-bit boolean type, and
45 <pre class="example"> .stabs "boolean:t10=@s64;-16",128,0,0,0
46 </pre>
48 <p>defines a 64-bit boolean type.
50 <p>A similar issue is the format of the type. This comes up most often for
51 floating-point types, which could have various formats (particularly
52 extended doubles, which vary quite a bit even among IEEE systems).
53 Again, it is best to define a new negative type number for each
54 different format; changing the format based on the target system has
55 various problems. One such problem is that the Alpha has both VAX and
56 IEEE floating types. One can easily imagine one library using the VAX
57 types and another library in the same executable using the IEEE types.
58 Another example is that the interpretation of whether a boolean is true
59 or false can be based on the least significant bit, most significant
60 bit, whether it is zero, etc., and different compilers (or different
61 options to the same compiler) might provide different kinds of boolean.
63 <p>The last major issue is the names of the types. The name of a given
64 type depends <em>only</em> on the negative type number given; these do not
65 vary depending on the language, the target system, or anything else.
66 One can always define separate type numbers--in the following list you
67 will see for example separate <code>int</code> and <code>integer*4</code> types
68 which are identical except for the name. But compatibility can be
69 maintained by not inventing new negative type numbers and instead just
70 defining a new type with a new name. For example:
72 <pre class="example"> .stabs "CARDINAL:t10=-8",128,0,0,0
73 </pre>
75 <p>Here is the list of negative type numbers. The phrase <dfn>integral
76 type</dfn> is used to mean twos-complement (I strongly suspect that all
77 machines which use stabs use twos-complement; most machines use
78 twos-complement these days).
80 <dl>
81 <dt><code>-1</code>
82 <dd><code>int</code>, 32 bit signed integral type.
84 <br><dt><code>-2</code>
85 <dd><code>char</code>, 8 bit type holding a character. Both GDB and dbx on AIX
86 treat this as signed. GCC uses this type whether <code>char</code> is signed
87 or not, which seems like a bad idea. The AIX compiler (<code>xlc</code>) seems to
88 avoid this type; it uses -5 instead for <code>char</code>.
90 <br><dt><code>-3</code>
91 <dd><code>short</code>, 16 bit signed integral type.
93 <br><dt><code>-4</code>
94 <dd><code>long</code>, 32 bit signed integral type.
96 <br><dt><code>-5</code>
97 <dd><code>unsigned char</code>, 8 bit unsigned integral type.
99 <br><dt><code>-6</code>
100 <dd><code>signed char</code>, 8 bit signed integral type.
102 <br><dt><code>-7</code>
103 <dd><code>unsigned short</code>, 16 bit unsigned integral type.
105 <br><dt><code>-8</code>
106 <dd><code>unsigned int</code>, 32 bit unsigned integral type.
108 <br><dt><code>-9</code>
109 <dd><code>unsigned</code>, 32 bit unsigned integral type.
111 <br><dt><code>-10</code>
112 <dd><code>unsigned long</code>, 32 bit unsigned integral type.
114 <br><dt><code>-11</code>
115 <dd><code>void</code>, type indicating the lack of a value.
117 <br><dt><code>-12</code>
118 <dd><code>float</code>, IEEE single precision.
120 <br><dt><code>-13</code>
121 <dd><code>double</code>, IEEE double precision.
123 <br><dt><code>-14</code>
124 <dd><code>long double</code>, IEEE double precision. The compiler claims the size
125 will increase in a future release, and for binary compatibility you have
126 to avoid using <code>long double</code>. I hope when they increase it they
127 use a new negative type number.
129 <br><dt><code>-15</code>
130 <dd><code>integer</code>. 32 bit signed integral type.
132 <br><dt><code>-16</code>
133 <dd><code>boolean</code>. 32 bit type. GDB and GCC assume that zero is false,
134 one is true, and other values have unspecified meaning. I hope this
135 agrees with how the IBM tools use the type.
137 <br><dt><code>-17</code>
138 <dd><code>short real</code>. IEEE single precision.
140 <br><dt><code>-18</code>
141 <dd><code>real</code>. IEEE double precision.
143 <br><dt><code>-19</code>
144 <dd><code>stringptr</code>. See <a href="Strings.html#Strings">Strings</a>.
146 <br><dt><code>-20</code>
147 <dd><code>character</code>, 8 bit unsigned character type.
149 <br><dt><code>-21</code>
150 <dd><code>logical*1</code>, 8 bit type. This Fortran type has a split
151 personality in that it is used for boolean variables, but can also be
152 used for unsigned integers. 0 is false, 1 is true, and other values are
153 non-boolean.
155 <br><dt><code>-22</code>
156 <dd><code>logical*2</code>, 16 bit type. This Fortran type has a split
157 personality in that it is used for boolean variables, but can also be
158 used for unsigned integers. 0 is false, 1 is true, and other values are
159 non-boolean.
161 <br><dt><code>-23</code>
162 <dd><code>logical*4</code>, 32 bit type. This Fortran type has a split
163 personality in that it is used for boolean variables, but can also be
164 used for unsigned integers. 0 is false, 1 is true, and other values are
165 non-boolean.
167 <br><dt><code>-24</code>
168 <dd><code>logical</code>, 32 bit type. This Fortran type has a split
169 personality in that it is used for boolean variables, but can also be
170 used for unsigned integers. 0 is false, 1 is true, and other values are
171 non-boolean.
173 <br><dt><code>-25</code>
174 <dd><code>complex</code>. A complex type consisting of two IEEE single-precision
175 floating point values.
177 <br><dt><code>-26</code>
178 <dd><code>complex</code>. A complex type consisting of two IEEE double-precision
179 floating point values.
181 <br><dt><code>-27</code>
182 <dd><code>integer*1</code>, 8 bit signed integral type.
184 <br><dt><code>-28</code>
185 <dd><code>integer*2</code>, 16 bit signed integral type.
187 <br><dt><code>-29</code>
188 <dd><code>integer*4</code>, 32 bit signed integral type.
190 <br><dt><code>-30</code>
191 <dd><code>wchar</code>. Wide character, 16 bits wide, unsigned (what format?
192 Unicode?).
194 <br><dt><code>-31</code>
195 <dd><code>long long</code>, 64 bit signed integral type.
197 <br><dt><code>-32</code>
198 <dd><code>unsigned long long</code>, 64 bit unsigned integral type.
200 <br><dt><code>-33</code>
201 <dd><code>logical*8</code>, 64 bit unsigned integral type.
203 <br><dt><code>-34</code>
204 <dd><code>integer*8</code>, 64 bit signed integral type.
205 </dl>
207 </body></html>