A question!!! 
Author Message
 A question!!!

Hello all,

        Is it possible to write a executable 'C' program without having
the main function???

Regards,
kumar



Mon, 04 Apr 2005 21:40:48 GMT  
 A question!!!
Impossible, I think.

Quote:
> Hello all,

>         Is it possible to write a executable 'C' program without having
> the main function???

> Regards,
> kumar



Mon, 04 Apr 2005 12:09:26 GMT  
 A question!!!
Submitted by "Kumar Ramadoss" to comp.lang.c:

Quote:
> Hello all,

>         Is it possible to write a executable 'C' program without having
> the main function???

> Regards,
> kumar

No.

--

-----------------------------+------ This post ends with :wq



Mon, 04 Apr 2005 12:21:55 GMT  
 A question!!!

Quote:

>         Is it possible to write a executable 'C' program without having
> the main function???

Not a portable program for a hosted implementation.


Mon, 04 Apr 2005 12:51:49 GMT  
 A question!!!

Quote:

> Hello all,

>         Is it possible to write a executable 'C' program without having
> the main function???

Yes. Freestanding implementations are under no obligation to call their
entry point "main".

On a hosted implementation, no.

--

"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton



Mon, 04 Apr 2005 13:08:12 GMT  
 A question!!!
Submitted by "Richard Heathfield" to comp.lang.c:

Quote:

>> Hello all,

>>         Is it possible to write a executable 'C' program without having
>> the main function???

> Yes. Freestanding implementations are under no obligation to call their
> entry point "main".

> On a hosted implementation, no.

I only have the draft standard here (been meaning to get the
real thing for quite some time now), and it says:

    5.1.2.2 Hosted environment
      A hosted environment need not be provided, but shall
      conform to the following specifications if present.

    5.1.2.2.1 Program startup
      The function called at program startup is named main.

Doesn't that say that even on a hosted implementation, the
main function needs to be called "main"?

Not that it makes any difference to me, but anyway.

--

-----------------------------+------ This post ends with :wq



Mon, 04 Apr 2005 13:55:03 GMT  
 A question!!!

Quote:

> Submitted by "Richard Heathfield" to comp.lang.c:

> >>         Is it possible to write a executable 'C' program without having
> >> the main function???

> > Yes. Freestanding implementations are under no obligation to call their
> > entry point "main".

> > On a hosted implementation, no.

> I only have the draft standard here (been meaning to get the
> real thing for quite some time now), and it says:

>     5.1.2.2 Hosted environment
>       A hosted environment need not be provided, but shall
>       conform to the following specifications if present.

>     5.1.2.2.1 Program startup
>       The function called at program startup is named main.

> Doesn't that say that even on a hosted implementation, the
> main function needs to be called "main"?

Yes.  And what do you mean by "even" on a hosted implementation?
That is the normal case that we treat in this newsgroup.  It is
freestanding implementation that is not required to have any
particular program startup function.
--
"In My Egotistical Opinion, most people's C programs should be indented six
 feet downward and covered with dirt." -- Blair P. Houghton


Mon, 04 Apr 2005 13:58:49 GMT  
 A question!!!
On Thu, 17 Oct 2002 05:55:03 -0000, Andreas K?h?ri

Quote:

>Submitted by "Richard Heathfield" to comp.lang.c:

>>> Hello all,

>>>         Is it possible to write a executable 'C' program without having
>>> the main function???

>> Yes. Freestanding implementations are under no obligation to call their
>> entry point "main".

>> On a hosted implementation, no.

>I only have the draft standard here (been meaning to get the
>real thing for quite some time now), and it says:

>    5.1.2.2 Hosted environment
>      A hosted environment need not be provided, but shall
>      conform to the following specifications if present.

>    5.1.2.2.1 Program startup
>      The function called at program startup is named main.

>Doesn't that say that even on a hosted implementation, the
>main function needs to be called "main"?

That's what he said. A hosted implementation is required to call the
startup function main. A freestanding implementation is not required
to do so.

-Kevin



Mon, 04 Apr 2005 14:11:38 GMT  
 A question!!!
Submitted by "Andreas K?h?ri" to comp.lang.c:

Quote:
> Submitted by "Richard Heathfield" to comp.lang.c:

>>> Hello all,

>>>         Is it possible to write a executable 'C' program without having
>>> the main function???

>> Yes. Freestanding implementations are under no obligation to call their
>> entry point "main".

>> On a hosted implementation, no.

> I only have the draft standard here (been meaning to get the
> real thing for quite some time now), and it says:

I was clearly mixing up "hosted" and "freestanding".  And in
addition to that, I seem to have mixed up "yes" and "no" in
Richard's post.  Apologies to all.

--

-----------------------------+------ This post ends with :wq



Mon, 04 Apr 2005 14:11:59 GMT  
 A question!!!
Submitted by "Ben Pfaff" to comp.lang.c:

Quote:

>> Submitted by "Richard Heathfield" to comp.lang.c:

>> >>         Is it possible to write a executable 'C' program without having
>> >> the main function???

>> > Yes. Freestanding implementations are under no obligation to call their
>> > entry point "main".

>> > On a hosted implementation, no.

>> I only have the draft standard here (been meaning to get the
>> real thing for quite some time now), and it says:

>>     5.1.2.2 Hosted environment
>>       A hosted environment need not be provided, but shall
>>       conform to the following specifications if present.

>>     5.1.2.2.1 Program startup
>>       The function called at program startup is named main.

>> Doesn't that say that even on a hosted implementation, the
>> main function needs to be called "main"?

> Yes.  And what do you mean by "even" on a hosted implementation?
> That is the normal case that we treat in this newsgroup.  It is
> freestanding implementation that is not required to have any
> particular program startup function.

 I know Ben.  I mixed "hosted" and "freestanding" up and totally
 failed to parse Richards reply.  Sorry.

--

-----------------------------+------ This post ends with :wq



Mon, 04 Apr 2005 17:21:10 GMT  
 A question!!!

Quote:

> Hello all,

>         Is it possible to write a executable 'C' program without having
> the main function???

Not in a hosted implementation.  A free-standing implementation
can provide other means to have an executable C program.


Mon, 04 Apr 2005 17:23:37 GMT  
 A question!!!

Quote:
>        Is it possible to write a executable 'C' program without having
>the main function???

Yes, if the definition of the main function comes from another source,
e.g. a library that is linked to your program.  This is relatively common
practice for tools that generate C programs as their output, like language
converters.

Dan
--
Dan Pop
DESY Zeuthen, RZ group



Mon, 04 Apr 2005 17:57:27 GMT  
 A question!!!


Quote:
> Submitted by "Andreas K?h?ri" to comp.lang.c:
> > Submitted by "Richard Heathfield" to comp.lang.c:

> >>> Hello all,

> >>>         Is it possible to write a executable 'C' program without
having
> >>> the main function???

> >> Yes. Freestanding implementations are under no obligation to call their
> >> entry point "main".

> >> On a hosted implementation, no.

> > I only have the draft standard here (been meaning to get the
> > real thing for quite some time now), and it says:

> I was clearly mixing up "hosted" and "freestanding".  And in
> addition to that, I seem to have mixed up "yes" and "no" in
> Richard's post.  Apologies to all.

I think the main() reason for this could be that you got
e{*filter*}d (which calls for an exclamation mark ('!')) about
catching Richard in an error, but put the '!' in the wrong
place, inverting what he really said.  Or something like
that.... :-)

#include <std!o.h>
#include <stdl!b.h>

!nt ma!n()
{
   !nt yes = 1;
   !nt no = 0;

   pr!ntf("R!chard made a m!stake. he sa!d %d", !yes);
   return EX!T_FA!LURE;

Quote:
}

-M!ke


Mon, 04 Apr 2005 23:21:39 GMT  
 A question!!!
...

Quote:
> #include <std!o.h>
> #include <stdl!b.h>

> !nt ma!n()
> {
>    !nt yes = 1;
>    !nt no = 0;

>    pr!ntf("R!chard made a m!stake. he sa!d %d", !yes);

      puts("");

Quote:
>    return EX!T_FA!LURE;
> }

Mike made a mistake.  :-)

Jirka



Mon, 04 Apr 2005 23:19:11 GMT  
 A question!!!


Quote:

> ...
> > #include <std!o.h>
> > #include <stdl!b.h>

> > !nt ma!n()
> > {
> >    !nt yes = 1;
> >    !nt no = 0;

> >    pr!ntf("R!chard made a m!stake. he sa!d %d", !yes);

>       puts("");

> >    return EX!T_FA!LURE;
> > }

> Mike made a mistake.  :-)

No, that wasn't me, that was my a!ter-ego, M!ke.

-:!

-Mike



Mon, 04 Apr 2005 23:35:47 GMT  
 
 [ 16 post ]  Go to page: [1] [2]

 Relevant Pages 

1. question question question

2. This is a biztalk question but probably an easy question for you C# guru's

3. Non-Programming Question... experience question mostly

4. Not C program question, historical question

5. A question regarding FAQs question 12.2

6. Question FAQ question

7. Peer to peer board game - possible remoting question or design question

8. if(question) || if question

9. array question - beginner question

10. questions, questions, and than some

11. Solaris Unix Porting Question / Signals Question

12. A similar lint question (and questions about casts)

 

 
Powered by phpBB® Forum Software