added documentation for field access to C pointers (#3088)

This commit is contained in:
Aaron Klapatch 2019-08-19 15:47:16 -05:00 committed by Andrew Kelley
parent d067a037cc
commit efc2237e5a

View File

@ -9322,6 +9322,13 @@ const c = @cImport({
<li>Does not support Zig-only pointer attributes such as alignment. Use normal {#link|Pointers#}
please!</li>
</ul>
<p>When a C pointer is pointing to a single struct (not an array), deference the C pointer to
access to the struct's fields or member data. That syntax looks like
this: </p>
<p>{#syntax#}ptr_to_struct.*.struct_member{#endsyntax#}</p>
<p>This is comparable to doing {#syntax#}->{#endsyntax#} in C.</p>
<p> When a C pointer is pointing to an array of structs, the syntax reverts to this:</p>
<p>{#syntax#}ptr_to_struct_array[index].struct_member{#endsyntax#}</p>
{#header_close#}
{#header_open|Exporting a C Library#}