const has internal linkage in C++, but external linkage in C.
Am I right ?
But, linker reports multiply-defined error if the
following header is included in multiple .cpp files.
// test_const.h
#ifndef HEADER_TEST
#define HEADER_TEST
const char* TEST_CONST = "Testing" ;
class some
{
// members
} ;
#endif
When I checked the symbol table, it was reported that,
[Index] Value Size Type Bind Other Shndx Name
[4] | 0| 4|OBJT |GLOB |0 |3 |TEST_CONST
Why?
Am I right ?
But, linker reports multiply-defined error if the
following header is included in multiple .cpp files.
// test_const.h
#ifndef HEADER_TEST
#define HEADER_TEST
const char* TEST_CONST = "Testing" ;
class some
{
// members
} ;
#endif
When I checked the symbol table, it was reported that,
[Index] Value Size Type Bind Other Shndx Name
[4] | 0| 4|OBJT |GLOB |0 |3 |TEST_CONST
Why?
Comment