in c++
class bar
{
int i;
char b;
float d;
};
void foo ( bar arg );
void foo ( bar &arg );
void foo ( bar *arg );
this i
The pointer and the reference methods should be quite comparable (both in speed, memory usage and generated code).
Passing a class directly forces the compiler to duplicate memory and put a copy of the bar object on the stack. What's worse, in C++ there are all sort of nasty bits (the default copy constructor and whatnot) associated with this.
In C I always use (possibly const) pointers. In C++ you should likely use references.