m-byte918 / AgarOSS

An Agar.io open source server implementation written in C++
31 stars 6 forks source link

Why do you pass simple data types by reference? #6

Closed NuclearC closed 6 years ago

NuclearC commented 6 years ago

For example this part:

 static int rand(const int& min, const int& max) {

Whats the reason for passing the integers by reference? I dont think it will save even a nanosecond for run-time.

m-byte918 commented 6 years ago

I read somewhere a while ago that passing types by reference is more efficient than by value, but I learned recently that it is not necessarily true for simple built in data types. I have fixed this in my private version.