[SDL] problems with repetitive playback
CWC
charlesw at blackfoot.net
Sat Apr 5 11:27:00 PDT 2008
Daniel Grace wrote:
> Passing by value would mean I could not pass a variable.
>
Passing by reference is a good habit to get into, but it doesn't buy you
anything when the object being referenced is the same size as the
resulting reference. (IE: passing anything larger than a pointer as a
reference instead, saves the object from being copied to the stack).
Since your objects are (likely) the same size as a pointer, you're not
getting anything out of passing by reference.
The only real question would be whether a const reference or a copy of
the variable performs faster, but to discover that, you'd have to get a
disassembly to see the overhead each way.
Syntactically, they are functionally equivalent. But if Solra is correct
and your compiler is messing things up, you could just copy the function
header, comment out one copy and change the other to pass all const
references by value instead. A quick compile and test will tell you if
that's where the problem lies. I suspect it's not the problem, but it
would be quick to find out for sure.
Good Luck,
CWC
More information about the SDL
mailing list