Search code examples
c++compiler-constructioncompilationgnugnu-toolchain

C++ compiler - common symbols


I have a question regarding the C++ compiler.

When exactly the C++ compiler will create a common symbol? With a C compiler I could provide common symbols to the object file, but if I compile the very same code with a C++ compiler (GNU), I only get only defined and undefined symbols.

So the question is what circumstances will cause a variable/function to be compiled as common in C++?


Solution

  • Some of them never do. The late and much-lamented Watcom C++ compiler made great use of common symbols to economize on inline function instances. There are various cases of extern that can also be resolved economically in this way.