[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Date: Tue, 16 Feb 1999 00:31:06 +1100
- From: ccj at acm.org (Chris Johns)
- Subject: RTEMS/autoconf
Jiri Gaisler wrote:
> Is there a reason to define main at all in the rtems sources? The
> only difference between main() and other routines is that a call
> to __main() is inserted by gcc - does this function do anything
> important for embedded targets? It would be certainly be more
> intutive if Init() and main() would swap functionality -
> Init() would take care of the system initialisation and main()
> would be the default init task written by the user as
> in normal C-program.
Interesting. I cannot see anything wrong for C++ users. Removes the
strange code to insure `new' works in the current `main'.
> If __main() indeed does something
> magic which needs to be done at an early stage, why not
> call __main() directly from Init()?
This could cause trouble as static object constructors could be called
twice if main is supplied. Not a good thing. IMO best left to the
compiler by providing `main'.
Chris Johns Networks, Plessey Asia Pacfic Pty. Ltd.
mailto:ccj at acm.org mailto:cjohns at plessey.com.au