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/static | |
parent | ssh-tunnel: grammar fix (diff) | |
download | blog-4759d2ad96dd4d874b8d901a0b469bace17aa4a4.tar.gz blog-4759d2ad96dd4d874b8d901a0b469bace17aa4a4.zip |
shorter code snippets
Diffstat (limited to '_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static')
3 files changed, 3 insertions, 6 deletions
diff --git a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/main.cpp b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/main.cpp index 7fbeb56..fde1a43 100644 --- a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/main.cpp +++ b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/main.cpp @@ -3,8 +3,7 @@ #include <iostream> -int main() -{ +int main() { std::cout << shared() << '\n'; std::cout << proxy() << '\n'; return 0; diff --git a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/proxy.cpp b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/proxy.cpp index a8eef26..78e4611 100644 --- a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/proxy.cpp +++ b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/proxy.cpp @@ -1,7 +1,6 @@ #include "proxy.hpp" #include "shared.hpp" -int proxy() -{ +int proxy() { return shared(); } diff --git a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/shared.hpp b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/shared.hpp index 6f812ab..647f49e 100644 --- a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/shared.hpp +++ b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/static/shared.hpp @@ -1,7 +1,6 @@ #pragma once -static int shared() -{ +static int shared() { static int n = 0; return ++n; } |