function reference from standard library
Peter Jeremy (peter.jeremy@auss2.alcatel.com.au)
Wed, 14 Oct 1998 13:35:32 +1000
Art Berggreen <art@acc.com> wrote:
>> You should change your declaration
>>to "int main (void)" [not "void main (void)" ... I don't think that's
>>considered legal anymore, if it ever was]
>Functions returning void are definitely legal.
In general, yes. BUT in ANSI-C, main() is not an ordinary function.
`main' is a magic name indicating that this is the program entry point.
It must be defined as either `int main(void)' or `int main(int, char **)'
(I'm not sure if `int main(int, char **, char **)' is strictly legal).
The compiler is also free to insert additional code into main to
perform program initialisation (eg calling C++ static constructors).
On many systems, gcc inserts a call to __main() for this purpose.
Peter
--
Peter Jeremy (VK2PJ) peter.jeremy@alcatel.com.au
Alcatel Australia Limited
41 Mandible St Phone: +61 2 9690 5019
ALEXANDRIA NSW 2015 Fax: +61 2 9690 5247
________________________________________________
To get help for the crossgcc list, send mail to
crossgcc-request@cygnus.com with the text 'help'
(without the quotes) in the body of the message.