Namespaces & main()
Martin von Loewis
martin@mira.isdn.cs.tu-berlin.de
Fri Oct 16 13:30:00 GMT 1998
> |> 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.
??? On i486-pc-linux-gnu, when given
int main(){}
egcs-2.92.15 produces, with -O2 -S -fno-exceptions
-fomit-frame-pointer the output
main:
xorl %eax,%eax
ret
The bugs with 'main' in a namespace is a different issue. The name
'main' is not special inside a namespace: it is not the program entry
point, nor defaults its return value to 0.
Regards,
Martin
More information about the Gcc
mailing list