Pete's Log: why c++ sucks.
Entry #482, (Coding, Hacking, & CS stuff)(posted when I was 22 years old.)
C++, the language that was supposed to bring about world peace, has failed us. Well, ok, by "has failed us" I mean "doesn't let us recursively call main". But g++ allows you to do so, as do all the C compilers with which I've tried to do so. So g++ allowing me to do so is probably yet another thing g++ does wrong (according to the standards, at least) but, the fact that C compilers let me do it is so very right. But does this mean that I've found an instance where C++ is not back compatible with C? And I really don't understand why they would not allow you to recursively call main. In the words of Rich Murphy, "It's just a function. A very, very special function..." ... amen! In other words of Rich Murphy, he asked if anybody had ever called me a pervert for trying to call main recursively. I said not yet, so he says "Consider it done... and a compliment." so I am feeling greatly honored right about now. woohoo!!!
And because they're kinda interesting, here are the error messages when I try to compile this code:
int main(int a, char** v) { return main(a, v); }
CC: Error: Cannot have a recursive call of main().
KCC: error: function "main" may not be called or have its address taken
g++, gcc, and cc all compile the above code without any complaints...