FFI: Change priority of table initializer variants for structs.
This commit is contained in:
@@ -517,17 +517,17 @@ A VLA is only initialized with the element(s) given in the table.
|
||||
Depending on the use case, you may need to explicitly add a
|
||||
<tt>NULL</tt> or <tt>0</tt> terminator to a VLA.</li>
|
||||
|
||||
<li>If the table has a non-empty hash part, a
|
||||
<tt>struct</tt>/<tt>union</tt> is initialized by looking up each field
|
||||
name (as a string key) in the table. Each non-<tt>nil</tt> value is
|
||||
used to initialize the corresponding field.</li>
|
||||
|
||||
<li>Otherwise a <tt>struct</tt>/<tt>union</tt> is initialized in the
|
||||
<li>A <tt>struct</tt>/<tt>union</tt> can be initialized in the
|
||||
order of the declaration of its fields. Each field is initialized with
|
||||
the consecutive table elements, starting at either index <tt>[0]</tt>
|
||||
consecutive table elements, starting at either index <tt>[0]</tt>
|
||||
or <tt>[1]</tt>. This process stops at the first <tt>nil</tt> table
|
||||
element.</li>
|
||||
|
||||
<li>Otherwise, if neither index <tt>[0]</tt> nor <tt>[1]</tt> is present,
|
||||
a <tt>struct</tt>/<tt>union</tt> is initialized by looking up each field
|
||||
name (as a string key) in the table. Each non-<tt>nil</tt> value is
|
||||
used to initialize the corresponding field.</li>
|
||||
|
||||
<li>Uninitialized fields of a <tt>struct</tt> are filled with zero
|
||||
bytes, except for the trailing VLA of a VLS.</li>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user