The new feature of C++17 'inline variable' vs 'extern' keyword inherited from C

1.2k views Asked by At

What's the difference between the inline specifier and the extern keyword when applied to a variable?

1

There are 1 answers

2
Maxim Egorushkin On

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. Without inline or const there will be multiple symbol definition linker error.