← Back to context

Comment by cowlevel

2 days ago

Historically it didn't work well between different compilers. Maybe it still doesn't.

Passing and returning structs by value has been part of C since C89. Most compilers pass small structs in individual registers, and nowadays with LTO they'll even elide the copy of bigger ones if they can. What's definitely the case though is that by-value structs weren't a common thing when most of the Unix API was written.

  • Structure assignment, passing, and returning were added in UNIX V7 C.