aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/_posts/snippets/static_vs_inline_vs_unnamed_namespaces/unnamed_namespaces/ok/main.cpp
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-04-15 19:33:02 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-04-15 19:33:08 +0300
commit4759d2ad96dd4d874b8d901a0b469bace17aa4a4 (patch)
treedecc917ac2092bbba710f00f3d18714cd7a9f69f /_posts/snippets/static_vs_inline_vs_unnamed_namespaces/unnamed_namespaces/ok/main.cpp
parentssh-tunnel: grammar fix (diff)
downloadjekyll-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.cpp19
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();