internal linkage what is that ? |
that means that the linker doesn't see that particular symbol outside the compiler unit (which is usually a *.cpp)
For instance:
a.cpp and b.cpp both can contain
static int x;
where x in a.cpp and b.cpp may have different value.
But a.cpp and b.cpp must
not contain
int x;
. The compiler would complain about multiple definitions
I guess unnamed namespace are useless... |
More so: if you have t.h:
1 2 3 4
|
namespace
{
int x;
}
|
There will be no complain from the compiler or linker. It's just that you have an instance of
x
with internal linkage in each compiler unit you include t.h
By the way: if you put a function prototype in such a unnamed namespace you have to implement that function in each .cpp you include t.h (and use that function) otherwise the linker cannot find definition.
And more strange effects to come.
Data is pretty much expose everywhere,, |
What does that mean? Global variables?
but it isn't since other file just include header file instead of the source... |
I don't get it
if I include the main source file ( Hero.cpp ) to extend it just to make it looks organized, would there is any disadvantages ? |
What do you mean?
#include
in another cpp? Don't do that