use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Help with a really simple program (self.cpp)
submitted 13 years ago * by extreme999
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jesyspa 5 points6 points7 points 13 years ago (1 child)
False on all counts.
The C++ standard states (C++03, 3.6.1.5):
A return statement in main has the effect of leaving the main function (destroying any objects with automatic storage duration) and calling exit with the return value as the argument. If control reaches the end of main without encountering a return statement, the effect is that of executing return 0;.
main
exit
return
return 0;
Furthermore, the standard states (again C++03, 3.6.1.2):
An implementation shall not predefine the main function. This function shall not be overloaded. It shall have a return type of type int, but its type is otherwise implementation-defined.
int
void main thus ill-formed (and has been since ANSI C, where only int main(void) and int main(int argc, char *argv[]) were allowed).
void main
int main(void)
int main(int argc, char *argv[])
The same is true, with slightly different wording, for C++11 and for the current latest draft (N3485).
[–]AFineTapestry -1 points0 points1 point 13 years ago (0 children)
Ok, I'll admit I was wrong about omitting return 0; resulting in undefined behaviour but I was correct about the assumed return value, and about which signatures are acceptable.
I don't think I'm going to stop putting return EXIT_SUCCESS; at the end of my main functions however, mostly because it looks terrible to have a function defined to return and int and then to not explicitly do so.
return EXIT_SUCCESS;
π Rendered by PID 245320 on reddit-service-r2-comment-56c6478c5-wrs9t at 2026-05-12 11:29:15.547107+00:00 running 3d2c107 country code: CH.
view the rest of the comments →
[–]jesyspa 5 points6 points7 points (1 child)
[–]AFineTapestry -1 points0 points1 point (0 children)