You actually raise a really good point! Do you need to define the main function? According to the c++ standards, you do need to define the main function. Now whether that main function is implicitly defined for you if you're missing one is up to the toolchain (clang, g++, msvc), but the final binary will be identical to one that is written with int main() {}. Please refer to: https://en.cppreference.com/w/cpp/language/main_function.
Unfortunately I don't know where I've read it, but there was a nice blogpost detailing "Smallest program that will crash", which went to a nice detail of the corner cases of C language.
4
u/[deleted] May 24 '20
Idk what the cpp program there is but it's not the simplest. The simplest program is