Namespaces & main()

Andreas Schwab schwab@issan.informatik.uni-dortmund.de
Fri Oct 16 04:10:00 GMT 1998


Todd Vierling <tv@pobox.com> writes:

|> On Wed, 14 Oct 1998, Branko Cibej wrote:
|> 
|> :      namespace A { int main() {} }
|> 
|> :      namespace-main.cc: In function `int main()':
|> :      namespace-main.cc:2: warning: control reaches end of non-void function `main()'
|> 
|> :      int main() {}
|> : 
|> : Did not produce a warning. All of this seems OK to me.
|> 
|> This part is correct.  The global "main" is explicitly defined in the C++
|> standard to return 0 if no return value is given.

Unfortunately g++ doesn't implement that yet.  Thus you'll currently get a
random exit code in this case.

Andreas.



More information about the Gcc mailing list