On Mon, Jul 27, 2015 at 07:30:39PM +0000, Lawrence Brakmo wrote: > > > I prefer the cleanliness of passing a structure and don¹t think the > overhead will be significant enough to worry about it. > Will the compiler pass struct values in registers if the struct is > passed by value?
In passing struct by value it's not a matter of optimization but C abi. On sparc even 4-byte structs are passed by reference which creates an extra copy of the same struct on stack. Struct returns are even worse. I would always pass structs by reference in C. C++ is different matter. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
