freestanding enviroment !

B

bhagatd

In freestanding environment name of the function called at program
startup can be other than 'main' how it is specified?
 
R

Richard Heathfield

(e-mail address removed) said:
In freestanding environment name of the function called at program
startup can be other than 'main' how it is specified?

Each implementation used for such environments will provide this information
in its documentation.
 
R

Richard Bos

In freestanding environment name of the function called at program
startup can be other than 'main' how it is specified?

You should be able to find such specifics in the implementation's
manual. There's no other reliable way to tell.

Richard
 
V

Vladimir S. Oka

In freestanding environment name of the function called at program
startup can be other than 'main' how it is specified?

It is up to the particular specification to specify it in any way it
chooses (IMO, it may even specify that you are allowed to specify it
through some documented mechanism). It has to be somewhere in your
documentation.
 
K

Keith Thompson

In freestanding environment name of the function called at program
startup can be other than 'main' how it is specified?

C99 5.1.2.1p1:

In a freestanding environment (in which C program execution may
take place without any benefit of an operating system), the name
and type of the function called at program startup are
implementation-defined.
 
C

Charles Krug

As others have said it is implementation-defined. The most popular
choice seems to be

void main(void);

since there are no startup parameters and freestanding programs normally
don't exit.

My experience is that you call it whatever you wish, and have some
platform-specific way of getting control transferred there.

If you call it main() the compiler can complain if you declare it wrong,
and folks here will do the same.
 
T

Thad Smith

In freestanding environment name of the function called at program
startup can be other than 'main' how it is specified?

As others have said it is implementation-defined. The most popular
choice seems to be

void main(void);

since there are no startup parameters and freestanding programs normally
don't exit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top