sudo apt-get purge tzdata-java sudo apt-get purge tzdata-java
A good explanation about the correct usage of argument passing to a function :
– references do not mean less memory usage.
– references do not mean faster code
– basic data types are cheap to copy
– copying basic data types once at the start of a function is often faster than dereferencing a reference several times throughout the life of a function.
– passing everything by reference all the time does not make for faster/better code.
– if the function is small it will likely be inlined anyway (provided it can be), so there’s no point in trying to micro-optimize it because the extra var will be optimized out by the compiler anyway.
Here are some very general rules that are applicable to 99.99% of situations:
Pass by value when the argument will not be modified, and is a basic data type (int, double, bool, etc)
The reason for this is because references are often implemented as pointers, and it is just as expensive to copy a pointer as it is to copy a basic data type since they both consume about the same amount of memory. The only difference is if you’re accessing a pointer/reference, the code is slower because you have to dereference it everytime you want to access the var, whereas if you make a copy you can just access it directly.
Pass by const reference when the argument will not be modified, and is a complex data type (string, vector, other types of classes)
The reason for this is twofold:
1) Copying large/complex objects can be expensive.
2) You often don’t access data members directly anyway. Member functions all have indirection through the ‘this’ pointer, so accessing member functions through a pointer does not have any overhead. So it’s usually not any slower to access an object by pointer/reference than it is to access them directly.
Pass by non-const reference only when the argument is to be modified (ie: it’s an “out” argument).
This is a clarity thing more than anything else. Passing by const reference or by value guarantees that the original value will not be changed. So if you pass by reference it implies that the function will change the passed var.
Considering one comment of a question in stackoverflow, I’ve disabled the “Symbol is not resolved” from the “Code Analysis” property of the project.
What makes this error annoying is that the code normally compiles and runs perfectly, but you see gazillions many errors in the “Problems” perspective, and red bugs on the corresponding lines on the editor window.
These are the installation instructions for the eclipse tools/extensions that I’ve been frequently using:
- First, install latest eclipse cdt, here.
- Add the mylyn site ( http://download.eclipse.org/mylyn/releases/latest ) to the installation locations, for up-to-date info, here.
Redmine Mylyn Connector
- Add the mylyn connector site ( http://redmin-mylyncon.sourceforge.net/update-site/N/ ) to the installation locations, for up-to-date info, here.
- Add the subclipse update site ( http://subclipse.tigris.org/update_1.6.x ) to the locations, for up-to-date info, here.
- First apt-get the valgrind package.
- More info about the valgrind tool, here. Especially, “massif” becomes handy, if you’re doing memory extensive processes.
- My personal file template for GNU GPL V3, here.
Tips & Tricks
Creating an eclipse project by using cmake:
Simply run cmake Eclipse generator inside the project folder as given below. This will add all the include paths correctly, and the only you should do is importing the project to the workspace via File->Import->General->Existing Projects into Workspace.
cmake -G"Eclipse CDT4 - Unix Makefiles"