   type vs. const type &
  What''s faster?type or const type &?For classes the const type & method should be faster (no constructor call, ...) but what about standart types like unsigned ints or floats?Thanks a lot   --------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened... 
  This depends on the type.  References involve an extra level of indirection, which can also mean a cache miss, depending on the circumstances.  The only time a reference will be faster is if you are passing a large/complicated object that you will access infrequently, since you only need to copy a 32-bit reference (or 64-bit on a 64-bit machine) instead of an (large number)-bit object plus copy constructor.  If you are going to access the object a lot though the indirection cost from each access may cost more than a full copy of the object would have.Enigma ;  So for unsigned ints and float direct pass is surely faster.But for indirections:Are references faster than pointers?   --------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened... ;  Yes, unsigned ints and floats are faster when passed by value (assuming you don''t have some wierd machine where int and float are much larger than a pointer).  References will be the same speed as pointers, since they are functionally equivalent on access.Enigma ;  Allright, thanks a lot!!   --------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened... 