aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAaron Klapatch <klapatchaaron@gmail.com>2019-08-19 15:47:16 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-08-19 16:47:16 -0400
commitefc2237e5a545fac94ecc9c9757d202bda322abd (patch)
tree79351fae4e7b432f963b17a26dbbe1c3f5ae649d /doc
parentd067a037cce906d600851e9b88df251451f9a93e (diff)
downloadzig-efc2237e5a545fac94ecc9c9757d202bda322abd.tar.gz
zig-efc2237e5a545fac94ecc9c9757d202bda322abd.zip
added documentation for field access to C pointers (#3088)
Diffstat (limited to 'doc')
-rw-r--r--doc/langref.html.in7
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in
index b2f313b234..c1fe08ddb6 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -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#}