Hacker News new | ask | show | jobs
by ncmncm 1698 days ago
When I do it on Linux, with gcc 10.2.1, it always returns 0, regardless of "-ansi", "-O2", or what-have-you. So, the author's experience is either peculiar to some old version of cc he used, or to a quirk of BSD.

The ISO C++ Standard dictates that if main fails to return a result, the program result is zero. And, g++ does this.

[Edit: I'm wrong... with "gcc -ansi -std=c90", with or without optimization, I get the 13! But not 10.]