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/unnamed_namespaces/ok/main.cpp | |
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/unnamed_namespaces/ok/main.cpp')
-rw-r--r-- | _posts/snippets/static_vs_inline_vs_unnamed_namespaces/unnamed_namespaces/ok/main.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/unnamed_namespaces/ok/main.cpp b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/unnamed_namespaces/ok/main.cpp index c0c0664..e383ded 100644 --- a/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/unnamed_namespaces/ok/main.cpp +++ b/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/unnamed_namespaces/ok/main.cpp @@ -2,18 +2,19 @@ #include <iostream> -namespace -{ - struct Test - { - Test() { std::cout << "main.cpp: Test::Test()\n"; } +namespace { + +struct Test { + Test() { + std::cout << "main.cpp: Test::Test()\n"; + } + + int x = 1; +}; - int x = 1; - }; } -int main() -{ +int main() { Test test; std::cout << test.x << '\n'; another(); |