Using in as a parameter qualifier
Shriramana Sharma
samjnaa at gmail.com
Fri May 31 16:09:07 PDT 2013
On Sat, Jun 1, 2013 at 1:13 AM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> Certainly,
> for anything that's small enough to fit in a register, it's likely to be faster
> to pass by value.
So pardon my ignorance, but a pair which only contains two doubles --
it would fit in a CPU register? How about a bezier class/struct which
contains 4 pairs i.e. 8 doubles?
And that would mean that passing by value is faster 'cause it's
cheaper to copy the data to a register and have the processor operate
on it directly than to copy the pointer (which lies beneath the
reference) and have the indirection and *then* copy (?) the data? (I
mean I'm not sure how these things work -- even when you are using a
pointer/reference, copying from the memory to CPU register is
unavoidable right? C++'s const T & only makes it so that copying from
memory-to-memory can be avoided, right?
--
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
More information about the Digitalmars-d-learn
mailing list