On 04/25/2018 01:23 PM, Jonathan Wakely wrote: > We enabled -Wreturn-type by default in GCC 8, so code using the > extension will get warnings even without -Wall now. Users might want > to use -Werror=return-type to ensure they aren't bitten by the new > optimizations that assume control never reaches the end of a > non-void function.
But ISO C++ allows control to reach the end of main(), and automagically returns 0. I guess you didn't mean that, but your reply was confusing. N4659, Section 6.6.1 Para 5: If control flows off the end of the compound-statement of main, the effect is equivalent to a return with operand 0 (see also 18.3). -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. <https://www.redhat.com> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671