diff options
Diffstat (limited to '_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline')
3 files changed, 5 insertions, 10 deletions
diff --git a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/shared.hpp b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/shared.hpp index 91313f2..796ea85 100644 --- a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/shared.hpp +++ b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/shared.hpp @@ -1,7 +1,6 @@ #pragma once -inline int shared() -{ +inline int shared() { static int n = 0; return ++n; } diff --git a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/weird/another.cpp b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/weird/another.cpp index 668516a..330ba80 100644 --- a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/weird/another.cpp +++ b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/weird/another.cpp @@ -2,12 +2,10 @@ #include <iostream> -inline void shared() -{ +inline void shared() { std::cout << "another.cpp: shared()\n"; } -void another() -{ +void another() { shared(); } diff --git a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/weird/main.cpp b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/weird/main.cpp index 4e32fb5..e278b9f 100644 --- a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/weird/main.cpp +++ b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline/weird/main.cpp @@ -2,13 +2,11 @@ #include <iostream> -inline void shared() -{ +inline void shared() { std::cout << "main.cpp: shared()\n"; } -int main() -{ +int main() { shared(); another(); return 0; |