From: "Steve Graegert" <graegerts@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: Startup function before main.
Date: Mon, 27 Mar 2006 14:20:09 +0200 [thread overview]
Message-ID: <6a00c8d50603270420t472c3aa7ocb27a4af07bdfeed@mail.gmail.com> (raw)
In-Reply-To: <4f2e7cd30603270401i51a6c167ncc3d74385b498a7c@mail.gmail.com>
On 3/27/06, Uday Karan <uday.karan@gmail.com> wrote:
> I really don't understand what is the need to have a
> initialization/start up routine before main(). Main is just like any
> other function except that it works as a default entry point to which
> the glibc start up code makes a call to.
>
> You can have a function main() as your start up routine that calls
> your application's main functions app_main() or something similar.
> You can do all your start up code in main itself and then call
> app_main().
>
> Simulating what you are trying to achieve here should not be very
> difficult. You can tweak your environment and stuff in main().
init-like constructors can be very helpful in some situations, like
profiling. It allows for preparation of the environment, loading of
libraries and the like. Doing that when main() has already been
called is not sufficient in these cases.
\Steve
next prev parent reply other threads:[~2006-03-27 12:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-27 11:07 Startup function before main krishna.vamsi
2006-03-27 11:48 ` Steve Graegert
2006-03-27 12:01 ` Uday Karan
2006-03-27 12:20 ` Steve Graegert [this message]
2006-03-27 17:48 ` Glynn Clements
-- strict thread matches above, loose matches on Subject: below --
2006-03-27 12:22 krishna.vamsi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a00c8d50603270420t472c3aa7ocb27a4af07bdfeed@mail.gmail.com \
--to=graegerts@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).