Skip to content

Commit 3722cbe

Browse files
Revert "Fix formatting to pass with checks"
This reverts commit 894f73b.
1 parent f316fb9 commit 3722cbe

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

.clang-format

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ BinPackParameters: false
5757
BitFieldColonSpacing: Both
5858
BraceWrapping:
5959
AfterCaseLabel: false
60-
AfterClass: true
60+
AfterClass: false
6161
AfterControlStatement: Never
6262
AfterEnum: false
6363
AfterExternBlock: false
64-
AfterFunction: true
64+
AfterFunction: false
6565
AfterNamespace: false
6666
AfterObjCDeclaration: false
67-
AfterStruct: true
68-
AfterUnion: true
69-
BeforeCatch: true
70-
BeforeElse: true
67+
AfterStruct: false
68+
AfterUnion: false
69+
BeforeCatch: false
70+
BeforeElse: false
7171
BeforeLambdaBody: false
7272
BeforeWhile: false
7373
IndentBraces: false
74-
SplitEmptyFunction: false
75-
SplitEmptyRecord: false
74+
SplitEmptyFunction: true
75+
SplitEmptyRecord: true
7676
SplitEmptyNamespace: true
7777
BreakAfterAttributes: Never
7878
BreakAfterJavaFieldAnnotations: false

examples/scope_example.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
void print_exit_status(std::string_view name, bool exit_status, bool did_throw)
99
{
1010
std::cout << name << ":\n";
11-
std::cout << " Exception thrown: " << (did_throw ? "yes" : "no") << "\n";
12-
std::cout << " Exit status: " << (exit_status ? "finished" : "pending") << "\n\n";
11+
std::cout << " Throwed exception " << (did_throw ? "yes" : "no") << "\n";
12+
std::cout << " Exit status " << (exit_status ? "finished" : "pending") << "\n\n";
1313
}
1414

1515
// Randomly throw an exception (50% chance)
@@ -24,44 +24,52 @@ int main()
2424
bool exit_status{false}, did_throw{false};
2525

2626
// Manual handling at "end of scope"
27-
try {
27+
try
28+
{
2829
maybe_throw();
2930
exit_status = true;
3031
}
31-
catch (...) {
32+
catch (...)
33+
{
3234
did_throw = true;
3335
}
3436
print_exit_status("Manual handling", exit_status, did_throw);
3537

3638
// Using scope_exit: runs on scope exit (success or exception)
3739
exit_status = did_throw = false;
38-
try {
40+
try
41+
{
3942
auto guard = std::experimental::scope_exit{[&] { exit_status = true; }};
4043
maybe_throw();
4144
}
42-
catch (...) {
45+
catch (...)
46+
{
4347
did_throw = true;
4448
}
4549
print_exit_status("scope_exit", exit_status, did_throw);
4650

4751
// Using scope_fail: runs only if an exception occurs
4852
exit_status = did_throw = false;
49-
try {
53+
try
54+
{
5055
auto guard = std::experimental::scope_fail{[&] { exit_status = true; }};
5156
maybe_throw();
5257
}
53-
catch (...) {
58+
catch (...)
59+
{
5460
did_throw = true;
5561
}
5662
print_exit_status("scope_fail", exit_status, did_throw);
5763

5864
// Using scope_success: runs only if no exception occurs
5965
exit_status = did_throw = false;
60-
try {
66+
try
67+
{
6168
auto guard = std::experimental::scope_success{[&] { exit_status = true; }};
6269
maybe_throw();
6370
}
64-
catch (...) {
71+
catch (...)
72+
{
6573
did_throw = true;
6674
}
6775
print_exit_status("scope_success", exit_status, did_throw);

0 commit comments

Comments
 (0)