Top "One-definition-rule" questions

Anything related to C++ One Definition Rule (ODR), i.e. a rule of the C++ standard banning multiple definitions of most language entities.

When should I write the keyword 'inline' for a function/method?

When should I write the keyword inline for a function/method in C++? After seeing some answers, some related questions: …

c++ inline one-definition-rule
Static variable in a Header File

Static variable has file scope. Say I have two following files: file1.h file1.cpp file2.h file2.cpp I …

c++ one-definition-rule
What does it mean to "ODR-use" something?

This just came up in the context of another question. Apparently member functions in class templates are only instantiated if …

c++ templates one-definition-rule
Necessity of forward-declaring template functions

I recently created this example code to illustrate C++11 variadic template function usage. template <typename Head, typename... Tail> …

c++ c++11 variadic-functions variadic-templates one-definition-rule
C the same global variable defined in different files

I am reading this code from here(in Chinese). There is one piece of code about testing global variable in …

c linker one-definition-rule
Why is multiple definition of a const global variable allowed in C++ and not in C?

Multiple definition of a global variable is not allowed in C or C++ due to the One Definition Rule. However, …

c++ c constants one-definition-rule
Impossibly Fast C++ Delegates and different translation units

According to Sergey Ryazanov, his Impossibly Fast C++ Delegates are not comparable: My delegates cannot be compared. Comparison operators are …

c++ delegates language-lawyer one-definition-rule