Skip to content

Commit feea110

Browse files
committed
Got rid of return 0 in some mains.
1 parent 9e6af8d commit feea110

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

Chapter 08 - Using Multiple Files/main.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,13 @@ int main() {
9494
std::cout << " " << e;
9595
std::cout << "\n";
9696

97-
return 0;
97+
// By the way, we've been writing return 0; at the end of every main
98+
// function. As I said before, the main function is weird: for example, you
99+
// can't call it from inside your program. Another (nice) quirk it has is
100+
// that you are allowed to omit the return statement at the end, and the
101+
// compiler will assume you returned 0. This means we can stop writing it
102+
// out now and let the compiler do the work.
103+
//
104+
// As you may have noticed, I'm extremely lazy and love letting software do
105+
// work for me.
98106
}

Chapter 09 - Iterators/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,4 @@ int main() {
3131
else
3232
std::cout << i << " was not amongst the numbers you entered.\n";
3333
}
34-
35-
return 0;
3634
}

Chapter 10 - References/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,4 @@ int main() {
289289
for (auto e : filter_greater_than(v, 5))
290290
std::cout << " " << e;
291291
std::cout << "\n";
292-
293-
return 0;
294292
}

Chapter 11 - Standard Algorithms/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,4 @@ int main() {
7575
std::cout << "Your input, sorted using a custom comparison function: ";
7676
display_range(v.begin(), v.end());
7777
std::cout << "\n";
78-
79-
return 0;
8078
}

0 commit comments

Comments
 (0)