Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Passing small structs in C

Name: Anonymous 2013-07-28 13:51

Hi prog. Got a C89 problem.

I want to pass small (less than 64B) structs throught functions that I can't inline because they are used several times elsewhere and are quite big. But it still need it to be very fast.

Should I pass the structs directly (thus copying them) or use a pointer (and getting a dereference penalty) ?

Name: Anonymous 2013-07-28 18:59

>>4
In no calling convention I have ever heard of will arguments be "packed" in registers. It's always one register per argument, and some CPUs have really weird additional contraints regarding sizes and alignment. Unless the struct is 4 members or less, use a pointer, unless you know exactly how your target platform works.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List