@agent max
Understand that projects have multiple coders, those big projects might have 200 of them: 20 teams of 10. Namespaces allow variables/functions/classes with the same name to be hidden from other parts of the project. It all boils down to the concept of
scope namespaces provide yet another way of providing a different scope, in turn this prevents clashes of names.
Also understand that libraries have their code in namespaces - look at the boost library. So if one wants to use anything in that library, one needs to deal with namespaces.
I understand that you are only writing small programs for school at the moment, but it is good practise to organise you code into namespaces, even if you never collaborate with anyone, it could save you from yourself when you write a program that is only a few KLOC.
agentmax wrote: |
---|
Holy mackerel! My computer would probably go splat on me if I tried to compile anything that took over a few minutes! |
it wouldn't. have a go at compiling the latest version of gcc or clang - see how long it takes. Make sure to configure it, so that it only does C++ or just the languages that you want to use. Otherwise it will do all of them, and you will have Ada, Fortran, Go etc without realising it. With gcc there is an option to set the number of cores to use, that will speed things up a bit.