Commit efc2237e5a

Aaron Klapatch <klapatchaaron@gmail.com>
2019-08-19 22:47:16
added documentation for field access to C pointers (#3088)
1 parent d067a03
Changed files (1)
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#}