diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-04-15 19:33:02 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-04-15 19:33:08 +0300 |
commit | 4759d2ad96dd4d874b8d901a0b469bace17aa4a4 (patch) | |
tree | decc917ac2092bbba710f00f3d18714cd7a9f69f /_posts/snippets/static_vs_inline_vs_unnamed_namespaces/inline | |
parent | ssh-tunnel: grammar fix (diff) | |
download | jekyll-theme-4759d2ad96dd4d874b8d901a0b469bace17aa4a4.tar.gz jekyll-theme-4759d2ad96dd4d874b8d901a0b469bace17aa4a4.zip |
shorter code snippets
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; |