authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-02-01 15:56:40+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-02-22 21:01:44+00:00
logdef7e2f20afa38417a195bb703179e0458ace274
tree647b19b72316f7e2aec0bad789053fd9a03691c7
parent31f353cd925a565dc32fa013c3ff767a06963adc
signaturelock-open Commit is signed but in an unrecognized format.

langref: improve description of `@fieldParentPtr`


1 files changed, 6 insertions(+), 1 deletions(-)

doc/langref.html.in+6-1
......@@ -4907,7 +4907,12 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
49074907 {#header_open|@fieldParentPtr#}
49084908 <pre>{#syntax#}@fieldParentPtr(comptime field_name: []const u8, field_ptr: *T) anytype{#endsyntax#}</pre>
49094909 <p>
4910 Given a pointer to a field, returns the base pointer of a struct.
4910 Given a pointer to a struct field, returns a pointer to the struct containing that field.
4911 The return type (and struct in question) is the inferred result type.
4912 </p>
4913 <p>
4914 If {#syntax#}field_ptr{#endsyntax#} does not point to the {#syntax#}field_name{#endsyntax#} field of an instance of
4915 the result type, and the result type has ill-defined layout, invokes unchecked {#link|Undefined Behavior#}.
49114916 </p>
49124917 {#header_close#}
49134918