[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RTEMS/autoconf





On Tue, 16 Feb 1999, Chris Johns wrote:

> 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'.

It could simplify things for the embedded targets.

> > 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'.

But if the application is required to provide main, then this would not
happen, would it?

--joel