When should I pass or return a struct by value?
问题 A struct can be either passed/returned by value or passed/returned by reference (via a pointer) in C. The general consensus seems to be that the former can be applied to small structs without penalty in most cases. See Is there any case for which returning a structure directly is good practice? and Are there any downsides to passing structs by value in C, rather than passing a pointer? And that avoiding a dereference can be beneficial from both a speed and clarity perspective. But what counts