docs, wrapping structs: add links to memory>struct and <direct-T-array>

db4
Jon Harper 2016-01-09 18:27:46 +01:00 committed by John Benediktsson
parent 53ce93a0da
commit 5b96d4d390
1 changed files with 1 additions and 1 deletions

View File

@ -170,7 +170,7 @@ ARTICLE: "classes.struct.c" "Passing structs to C functions"
$nl
"If a parameter is declared with a struct type, the parameter is passed by value. To pass a struct by reference, declare a parameter with a pointer to struct type."
$nl
"If a C function is declared as returning a struct type, the struct is returned by value, and wrapped in an instance of the correct struct class automatically. If a C function is declared as returning a pointer to a struct, it will return an " { $link alien } " instance. This is because there is no way to distinguish between a pointer to a single struct and a pointer to an array of zero or more structs. It is up to the caller to wrap it in a struct, or a specialized array of structs, respectively."
"If a C function is declared as returning a struct type, the struct is returned by value, and wrapped in an instance of the correct struct class automatically. If a C function is declared as returning a pointer to a struct, it will return an " { $link alien } " instance. This is because there is no way to distinguish between a pointer to a single struct and a pointer to an array of zero or more structs. It is up to the caller to wrap it in a struct using " { $link memory>struct } ", or a specialized array of structs using " { $snippet "<direct-T-array>" } ", respectively."
$nl
"An example of a struct declaration:"
{ $code