Const static variable defined in header file has same address in different translation unit
问题 I have checked out the definition of std::ios::app in /usr/include/c++/4.6/bits/ios_base.h and found that std::ios::app is defined as a const static variable: typedef _Ios_Openmode openmode; /// Seek to end before each write. static const openmode app = _S_app; in which _Ios_Openmode is defined in the same header file as enum _Ios_Openmode { _S_app = 1L << 0, _S_ate = 1L << 1, _S_bin = 1L << 2, _S_in = 1L << 3, _S_out = 1L << 4, _S_trunc = 1L << 5, _S_ios_openmode_end = 1L << 16 }; It's well