1
0
mirror of https://github.com/KarolS/millfork.git synced 2026-04-21 09:16:34 +00:00

Add struct literals

This commit is contained in:
Karol Stasiak
2019-06-25 00:45:49 +02:00
parent 978d97cd7d
commit e394fe15c3
6 changed files with 141 additions and 3 deletions
+8
View File
@@ -147,6 +147,12 @@ Offsets are available as `structname.fieldname.offset`:
// alternatively:
ptr = p.y.addr
You can create constant expressions of struct types using so-called struct constructors, e.g.:
point(5,6)
All arguments to the constructor must be constant.
## Unions
union <name> { <field definitions (type and name), separated by commas or newlines>}
@@ -163,3 +169,5 @@ start at the same point in memory and therefore overlap each other.
if u.w == 0 { ok() }
Offset constants are also available, but they're obviously all zero.
Unions currently do not have an equivalent of struct constructors. This may be improved on in the future.