1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-19 06:31:31 +00:00

Improve doc for .struct/.union

git-svn-id: svn://svn.cc65.org/cc65/trunk@3365 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2005-01-11 06:51:24 +00:00
parent e06d9d0d84
commit d63dc84262

View File

@ -3730,12 +3730,17 @@ compiler, depending on the target system selected:
<sect>Structs and unions<label id="structs"><p>
<sect1>Overview<p>
Structs and unions are special forms of <ref id="scopes" name="scopes">. They
are to some degree comparable to their C counterparts. Both have a list of
members. Each member allocates storage and may optionally have a name, which,
in case of a struct, is the offset from the beginning and, in case of a union,
is always zero.
<sect1>Declaration<p>
Here is an example for a very simple struct with two members and a total size
of 4 bytes:
@ -3765,8 +3770,11 @@ storage allocators may contain a multiplier, as in the example below:
.endstruct
</verb></tscreen>
Using the <ref id=".TAG" name=".TAG"> keyword, it is possible to embedd
already defined structs or unions in structs:
<sect1>The <tt/.TAG/ keyword<p>
Using the <ref id=".TAG" name=".TAG"> keyword, it is possible to reserve space
for an already defined struct or unions within another struct:
<tscreen><verb>
.struct Point
@ -3798,6 +3806,18 @@ of the struct itself:
This may change in a future version of the assembler.
<sect1>Limitations<p>
Structs and unions are currently implemented as nested symbol tables (in fact,
they were a by-product of the improved scoping rules). Currently, the
assembler has no idea of types. This means that the <ref id=".TAG"
name=".TAG"> keyword will only allocate space. You won't be able to initialize
variables declared with <ref id=".TAG" name=".TAG">, and adding an embedded
structure to another structure with <ref id=".TAG" name=".TAG"> will not make
this structure accessible by using the '::' operator.
<sect>Module constructors/destructors<label id="condes"><p>
<em>Note:</em> This section applies mostly to C programs, so the explanation