commit efc2237e5a545fac94ecc9c9757d202bda322abd (tree) parent d067a037cce906d600851e9b88df251451f9a93e Author: Aaron Klapatch <klapatchaaron@gmail.com> Date: Mon, 19 Aug 2019 15:47:16 -0500 added documentation for field access to C pointers (#3088) Diffstat:
| M | doc/langref.html.in | | | 7 | +++++++ |
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git 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#}