What's the difference between the inline
specifier and the extern
keyword when applied to a variable?
The new feature of C++17 'inline variable' vs 'extern' keyword inherited from C
1.2k views Asked by Zeyd At
1
What's the difference between the inline
specifier and the extern
keyword when applied to a variable?
extern
says that the variable definition resides in a translation unit elsewhere.inline
for global/namespace scope variable means that the definition is provided at the spot. Withoutinline
orconst
there will be multiple symbol definition linker error.