mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 04:30:10 +00:00
Describe initialized void variables
git-svn-id: svn://svn.cc65.org/cc65/trunk@569 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
0758d34f4b
commit
b2b7fb4b33
@ -429,6 +429,32 @@ This cc65 version has some extensions to the ISO C standard.
|
||||
The macro will print the name of the current function plus a given
|
||||
string.
|
||||
<p>
|
||||
|
||||
<item> cc65 allows the initialization of <tt/void/ variables. This may be
|
||||
used to create variable structures that are more compatible with
|
||||
interfaces written for assembler languages. Here is an example:
|
||||
|
||||
<tscreen><verb>
|
||||
void GCmd = { (char)3, (unsigned)0x2000, (unsigned)0x3000 };
|
||||
</verb></tscreen>
|
||||
|
||||
This will be translated as follows:
|
||||
|
||||
<tscreen><verb>
|
||||
_GCmd:
|
||||
.byte 3
|
||||
.word $2000
|
||||
.word $3000
|
||||
</verb></tscreen>
|
||||
|
||||
Since the variable is of type <tt/void/ you may not use it as is.
|
||||
However, taking the address of the variable results in a <tt/void*/
|
||||
which may be passed to any function expecting a pointer.
|
||||
|
||||
See the <htmlurl url="geos.html" name="GEOS library"> for examples on
|
||||
how to use this feature.
|
||||
<p>
|
||||
|
||||
</itemize>
|
||||
<p>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user