Originally posted by Banfa
The curley bracket!
Collapse
X
-
Most of the computers (more than 99%) are small, cheap embedded computers with limited memory and speed.Originally posted by AricCWith the speeds of PC processing these days I wouldn't think this is a big factor. Do you any have proof?
In the case of ++ with a primitive type, it does not make a big difference, but you should use it for convention. (someday you will do ++ for your own class).
Just imagine you have a class that stores a lot of information, say 1MB, create a copy of this will take much longer time than just sending a reference.
I think some code will explain this better, in this simple example ++ should only increment index.
Do you see the difference?Code:// prefix UrClass& UrClass::operator++() { ++index; return *this; } // postfix const UrClass UrClass::operator++() { UrClass temp(*this); ++*this; return temp; }Comment
Comment