Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / info / stabs / Unions.html
bloba9fbda5034c0bdfb5dcd65014a09fc7ae5dc33b3
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="Unions">Unions</a>,
13 Next:<a rel="next" accesskey="n" href="Function-Types.html#Function%20Types">Function Types</a>,
14 Previous:<a rel="previous" accesskey="p" href="Typedefs.html#Typedefs">Typedefs</a>,
15 Up:<a rel="up" accesskey="u" href="Types.html#Types">Types</a>
16 <hr><br>
17 </div>
19 <h3 class="section">Unions</h3>
21 <pre class="example"> union u_tag {
22 int u_int;
23 float u_float;
24 char* u_char;
25 } an_u;
26 </pre>
28 <p>This code generates a stab for a union tag and a stab for a union
29 variable. Both use the <code>N_LSYM</code> stab type. If a union variable is
30 scoped locally to the procedure in which it is defined, its stab is
31 located immediately preceding the <code>N_LBRAC</code> for the procedure's block
32 start.
34 <p>The stab for the union tag, however, is located preceding the code for
35 the procedure in which it is defined. The stab type is <code>N_LSYM</code>. This
36 would seem to imply that the union type is file scope, like the struct
37 type <code>s_tag</code>. This is not true. The contents and position of the stab
38 for <code>u_type</code> do not convey any information about its procedure local
39 scope.
41 <pre class="smallexample"> # 128 is N_LSYM
42 .stabs "u_tag:T23=u4u_int:1,0,32;u_float:12,0,32;u_char:21,0,32;;",
43 128,0,0,0
44 </pre>
46 <p>The symbol descriptor <code>T</code>, following the <code>name:</code> means that
47 the stab describes an enumeration, structure, or union tag. The type
48 descriptor <code>u</code>, following the <code>23=</code> of the type definition,
49 narrows it down to a union type definition. Following the <code>u</code> is
50 the number of bytes in the union. After that is a list of union element
51 descriptions. Their format is <var>name:type, bit offset into the
52 union, number of bytes for the element;</var>.
54 <p>The stab for the union variable is:
56 <pre class="example"> .stabs "an_u:23",128,0,0,-20 # 128 is N_LSYM
57 </pre>
59 <p><code>-20</code> specifies where the variable is stored (see <a href="Stack-Variables.html#Stack%20Variables">Stack Variables</a>).
61 </body></html>