public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* __main
@ 2002-08-29 11:25 Robert Spanton
  2002-08-29 11:40 ` __main Fergus Henderson
  0 siblings, 1 reply; 18+ messages in thread
From: Robert Spanton @ 2002-08-29 11:25 UTC (permalink / raw)
  To: gcc

Why is it that when i compile the following code (using the -S switch) under
windows, GCC outputs an assembly file containing the symbol "__main" (two
underscores) AND the symbol "_main" (one underscore) - whereas when i
compile it under unix or bsd, it only contains the symbol "_main" (one
underscore). Why do the unix and bsd versions not output the symbol
"__main"?

Code:

int main()
{
return 0;
}


Robert

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-08-29 11:25 __main Robert Spanton
@ 2002-08-29 11:40 ` Fergus Henderson
  2002-08-29 22:18   ` __main Mike Laman
  0 siblings, 1 reply; 18+ messages in thread
From: Fergus Henderson @ 2002-08-29 11:40 UTC (permalink / raw)
  To: Robert Spanton; +Cc: gcc

On 29-Aug-2002, Robert Spanton <rob@xgoat.com> wrote:
> Why is it that when i compile the following code (using the -S switch) under
> windows, GCC outputs an assembly file containing the symbol "__main" (two
> underscores) AND the symbol "_main" (one underscore) - whereas when i
> compile it under unix or bsd, it only contains the symbol "_main" (one
> underscore). Why do the unix and bsd versions not output the symbol
> "__main"?

On some systems, gcc inserts a call to __main() at the start of the
code that it generates for main().  __main() is called to execute
initialization code, in particular constructors for C++ objects with
global or namespace scope.

On systems which use the ELF object file format, there are special
sections in the object file for registering initialization code, and
gcc will use these.  The program loader (and/or the C runtime start-up
code) will then ensure that the initialization code gets run, perhaps
even before main() is entered, so there's no need for gcc to call __main().

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: < http://www.cs.mu.oz.au/~fjh >  |     -- the last words of T. S. Garp.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-08-29 11:40 ` __main Fergus Henderson
@ 2002-08-29 22:18   ` Mike Laman
  2002-09-01  9:04     ` __main Fergus Henderson
  2002-09-02 19:37     ` __main Zack Weinberg
  0 siblings, 2 replies; 18+ messages in thread
From: Mike Laman @ 2002-08-29 22:18 UTC (permalink / raw)
  To: GCC

When running a C cross compiler where one does not want a call
to "__main()" to be emitted, how can one turn it off?

Thanks in advance,
Mike

----- Original Message -----
From: "Fergus Henderson" <fjh@cs.mu.OZ.AU>
To: "Robert Spanton" <rob@xgoat.com>
Cc: <gcc@gcc.gnu.org>
Sent: Thursday, August 29, 2002 11:40 AM
Subject: Re: __main


> On 29-Aug-2002, Robert Spanton <rob@xgoat.com> wrote:
> > Why is it that when i compile the following code (using the -S switch)
under
> > windows, GCC outputs an assembly file containing the symbol "__main"
(two
> > underscores) AND the symbol "_main" (one underscore) - whereas when i
> > compile it under unix or bsd, it only contains the symbol "_main" (one
> > underscore). Why do the unix and bsd versions not output the symbol
> > "__main"?
>
> On some systems, gcc inserts a call to __main() at the start of the
> code that it generates for main().  __main() is called to execute
> initialization code, in particular constructors for C++ objects with
> global or namespace scope.
>
> On systems which use the ELF object file format, there are special
> sections in the object file for registering initialization code, and
> gcc will use these.  The program loader (and/or the C runtime start-up
> code) will then ensure that the initialization code gets run, perhaps
> even before main() is entered, so there's no need for gcc to call
__main().
>
> --
> Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the
pursuit
> The University of Melbourne         |  of excellence is a lethal habit"
> WWW: < http://www.cs.mu.oz.au/~fjh >  |     -- the last words of T. S. Garp.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-08-29 22:18   ` __main Mike Laman
@ 2002-09-01  9:04     ` Fergus Henderson
  2002-09-01 13:14       ` __main Mike Laman
  2002-09-02 19:37     ` __main Zack Weinberg
  1 sibling, 1 reply; 18+ messages in thread
From: Fergus Henderson @ 2002-09-01  9:04 UTC (permalink / raw)
  To: Mike Laman; +Cc: GCC

On 29-Aug-2002, Mike Laman <mlaman@cox.net> wrote:
> When running a C cross compiler where one does not want a call
> to "__main()" to be emitted, how can one turn it off?

I don't know off-hand if it can be turned off.
(I doubt if it can, but perhaps with `-ffreestanding'??)
Of course you can always turn it off by modifying the source code!

Probably the easiest solution is to just define a dummy __main()
function that does nothing.  You'd better be sure that you don't
link in any C++ programs or libraries, though, because they might
not work properly if constructors for static objects are not
executed.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-01  9:04     ` __main Fergus Henderson
@ 2002-09-01 13:14       ` Mike Laman
  2002-09-01 13:22         ` __main Mike Laman
  2002-09-01 22:56         ` __main Fergus Henderson
  0 siblings, 2 replies; 18+ messages in thread
From: Mike Laman @ 2002-09-01 13:14 UTC (permalink / raw)
  To: GCC

I'm trying very hard not to modify the source.

I've got to think that others porting GCC to small chips will have the
same issue. For me space is very important. Unfortunately, the bytes count.

Also the standard assembler for this chip does not accept an "_" for
the first character. Don't look at me - I didn't write it, but I do need to
interface with it.

I'll give -ffreestanding a try.

Thanks,
Mike
----- Original Message -----
From: "Fergus Henderson" <fjh@cs.mu.OZ.AU>
To: "Mike Laman" <mlaman@cox.net>
Cc: "GCC" <gcc@gcc.gnu.org>
Sent: Sunday, September 01, 2002 9:04 AM
Subject: Re: __main


> On 29-Aug-2002, Mike Laman <mlaman@cox.net> wrote:
> > When running a C cross compiler where one does not want a call
> > to "__main()" to be emitted, how can one turn it off?
>
> I don't know off-hand if it can be turned off.
> (I doubt if it can, but perhaps with `-ffreestanding'??)
> Of course you can always turn it off by modifying the source code!
>
> Probably the easiest solution is to just define a dummy __main()
> function that does nothing.  You'd better be sure that you don't
> link in any C++ programs or libraries, though, because they might
> not work properly if constructors for static objects are not
> executed.
>
> --
> Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the
pursuit
> The University of Melbourne         |  of excellence is a lethal habit"
> WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-01 13:14       ` __main Mike Laman
@ 2002-09-01 13:22         ` Mike Laman
  2002-09-01 13:40           ` __main Robert Spanton
  2002-09-02  5:29           ` __main Ian Dall
  2002-09-01 22:56         ` __main Fergus Henderson
  1 sibling, 2 replies; 18+ messages in thread
From: Mike Laman @ 2002-09-01 13:22 UTC (permalink / raw)
  To: GCC

I tried it. I still get the __main call.

Any other ideas?

I do appreciate the help and time! Tks,
Mike

----- Original Message -----
From: "Mike Laman" <mlaman@cox.net>
To: "GCC" <gcc@gcc.gnu.org>
Sent: Sunday, September 01, 2002 1:15 PM
Subject: Re: __main


> I'm trying very hard not to modify the source.
>
> I've got to think that others porting GCC to small chips will have the
> same issue. For me space is very important. Unfortunately, the bytes
count.
>
> Also the standard assembler for this chip does not accept an "_" for
> the first character. Don't look at me - I didn't write it, but I do need
to
> interface with it.
>
> I'll give -ffreestanding a try.
>
> Thanks,
> Mike
> ----- Original Message -----
> From: "Fergus Henderson" <fjh@cs.mu.OZ.AU>
> To: "Mike Laman" <mlaman@cox.net>
> Cc: "GCC" <gcc@gcc.gnu.org>
> Sent: Sunday, September 01, 2002 9:04 AM
> Subject: Re: __main
>
>
> > On 29-Aug-2002, Mike Laman <mlaman@cox.net> wrote:
> > > When running a C cross compiler where one does not want a call
> > > to "__main()" to be emitted, how can one turn it off?
> >
> > I don't know off-hand if it can be turned off.
> > (I doubt if it can, but perhaps with `-ffreestanding'??)
> > Of course you can always turn it off by modifying the source code!
> >
> > Probably the easiest solution is to just define a dummy __main()
> > function that does nothing.  You'd better be sure that you don't
> > link in any C++ programs or libraries, though, because they might
> > not work properly if constructors for static objects are not
> > executed.
> >
> > --
> > Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the
> pursuit
> > The University of Melbourne         |  of excellence is a lethal habit"
> > WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S.
Garp.
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-01 13:22         ` __main Mike Laman
@ 2002-09-01 13:40           ` Robert Spanton
  2002-09-02  4:26             ` __main Lars Brinkhoff
  2002-09-02  5:29           ` __main Ian Dall
  1 sibling, 1 reply; 18+ messages in thread
From: Robert Spanton @ 2002-09-01 13:40 UTC (permalink / raw)
  To: gcc

When I compile some code under windows it outputs __main, but when I compile
it under linux I don't get it - does anyone know why?

Robert

www.xgoat.com

----- Original Message -----
From: "Mike Laman" <mlaman@cox.net>
To: "GCC" <gcc@gcc.gnu.org>
Sent: Sunday, September 01, 2002 9:24 PM
Subject: Re: __main


> I tried it. I still get the __main call.
>
> Any other ideas?
>
> I do appreciate the help and time! Tks,
> Mike
>
> ----- Original Message -----
> From: "Mike Laman" <mlaman@cox.net>
> To: "GCC" <gcc@gcc.gnu.org>
> Sent: Sunday, September 01, 2002 1:15 PM
> Subject: Re: __main
>
>
> > I'm trying very hard not to modify the source.
> >
> > I've got to think that others porting GCC to small chips will have the
> > same issue. For me space is very important. Unfortunately, the bytes
> count.
> >
> > Also the standard assembler for this chip does not accept an "_" for
> > the first character. Don't look at me - I didn't write it, but I do need
> to
> > interface with it.
> >
> > I'll give -ffreestanding a try.
> >
> > Thanks,
> > Mike
> > ----- Original Message -----
> > From: "Fergus Henderson" <fjh@cs.mu.OZ.AU>
> > To: "Mike Laman" <mlaman@cox.net>
> > Cc: "GCC" <gcc@gcc.gnu.org>
> > Sent: Sunday, September 01, 2002 9:04 AM
> > Subject: Re: __main
> >
> >
> > > On 29-Aug-2002, Mike Laman <mlaman@cox.net> wrote:
> > > > When running a C cross compiler where one does not want a call
> > > > to "__main()" to be emitted, how can one turn it off?
> > >
> > > I don't know off-hand if it can be turned off.
> > > (I doubt if it can, but perhaps with `-ffreestanding'??)
> > > Of course you can always turn it off by modifying the source code!
> > >
> > > Probably the easiest solution is to just define a dummy __main()
> > > function that does nothing.  You'd better be sure that you don't
> > > link in any C++ programs or libraries, though, because they might
> > > not work properly if constructors for static objects are not
> > > executed.
> > >
> > > --
> > > Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the
> > pursuit
> > > The University of Melbourne         |  of excellence is a lethal
habit"
> > > WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S.
> Garp.
> >

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-01 13:14       ` __main Mike Laman
  2002-09-01 13:22         ` __main Mike Laman
@ 2002-09-01 22:56         ` Fergus Henderson
  2002-09-02  3:36           ` __main Mike Laman
  1 sibling, 1 reply; 18+ messages in thread
From: Fergus Henderson @ 2002-09-01 22:56 UTC (permalink / raw)
  To: Mike Laman; +Cc: GCC

On 01-Sep-2002, Mike Laman <mlaman@cox.net> wrote:
> I've got to think that others porting GCC to small chips will have the
> same issue. For me space is very important. Unfortunately, the bytes count.

How many bytes are we talking about?  
On x86 it's only half a dozen bytes, per program.
I'm sorry, but I just can get very excited about that.

> Also the standard assembler for this chip does not accept an "_" for
> the first character. Don't look at me - I didn't write it, but I do need to
> interface with it.

Not a GCC problem.
If that's the real issue, then you are mailing the wrong list.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-01 22:56         ` __main Fergus Henderson
@ 2002-09-02  3:36           ` Mike Laman
  2002-09-02  5:51             ` __main Fergus Henderson
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Laman @ 2002-09-02  3:36 UTC (permalink / raw)
  To: GCC

Hi,

We're talk about 6 bytes for the call and 2 bytes to immediately
bounce back. 8 bytes certainly aren't much, but I'm working with
only a few Kilobytes(!) of space, so please excuse my "enthusiasm"
for every byte I can save. (Being able to use the optimizing abilities
of GCC was one big reason to use GCC, among may other pluses!)

This machine will not be run C++. Just C, so I won't need "__main".

As for the assembler, there's a big attempt to allow us to output
code for other assemblers, but it has some assumptions that are invalid.
Like tabs. Invalid characters (underscores starting a symbol).

I hate the idea of writing a silly little program to mangle the compiler
output to make it valid assembly (tabs, underscores,
what-ever-else-comes-up-I-continue-to-battle, ...),
so I can then assemble it. And I sure don't want to hack GCC
for my own version, then I'll be perpetually hacking it,
and that's a lot of overhead. And I understand others may not
want to make any of these changes (They're "only my problem").
It's just that having to write an assembly massager seems to go
against the goal of the cross compiling abilities, but reality isn't
elegant.

GCC is a cross compiler, so I would hope that part of the goal of
making this a cross compiler is that I don't need to post process the GCC
assembly output before I can assemble it.

Maybe I'm missing the point, but I think these issues are with the
compiler - not the assembler. The assembler is already defined -
such can be the life with cross compiling.

Please don't misunderstand me. I certainly appreciate the help. One way or
another
I'll make things happen. I'm just raising issues I've come up with. They're
probably going to be only my problems, though I do get concerned as the
number of issues start add up. I do see others talking about ports to other
processors
giving me the impression they may have the some of the same issues that I
have,
so I raise the issues here.

Thanks again,
Mike

----- Original Message -----
From: "Fergus Henderson" <fjh@cs.mu.oz.au>
To: "Mike Laman" <mlaman@cox.net>
Cc: "GCC" <gcc@gcc.gnu.org>
Sent: Sunday, September 01, 2002 10:56 PM
Subject: Re: __main


> On 01-Sep-2002, Mike Laman <mlaman@cox.net> wrote:
> > I've got to think that others porting GCC to small chips will have the
> > same issue. For me space is very important. Unfortunately, the bytes
count.
>
> How many bytes are we talking about?
> On x86 it's only half a dozen bytes, per program.
> I'm sorry, but I just can get very excited about that.
>
> > Also the standard assembler for this chip does not accept an "_" for
> > the first character. Don't look at me - I didn't write it, but I do need
to
> > interface with it.
>
> Not a GCC problem.
> If that's the real issue, then you are mailing the wrong list.
>
> --
> Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the
pursuit
> The University of Melbourne         |  of excellence is a lethal habit"
> WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-01 13:40           ` __main Robert Spanton
@ 2002-09-02  4:26             ` Lars Brinkhoff
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Brinkhoff @ 2002-09-02  4:26 UTC (permalink / raw)
  To: Robert Spanton; +Cc: Mike Laman, gcc

"Robert Spanton" <rob@xgoat.com> writes:
> When I compile some code under windows it outputs __main, but when I
> compile it under linux I don't get it - does anyone know why?

I guess because of this #ifndef in function.c:

  #ifndef HAS_INIT_SECTION
    emit_library_call (gen_rtx_SYMBOL_REF (Pmode, NAME__MAIN), LCT_NORMAL,
                       VOIDmode, 0);
  #endif

NAME_MAIN is "__main" by default.

-- 
Lars Brinkhoff          http://lars.nocrew.org/     Linux, GCC, PDP-10,
Brinkhoff Consulting    http://www.brinkhoff.se/    HTTP programming

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-01 13:22         ` __main Mike Laman
  2002-09-01 13:40           ` __main Robert Spanton
@ 2002-09-02  5:29           ` Ian Dall
  2002-09-02 19:08             ` __main Mike Laman
  1 sibling, 1 reply; 18+ messages in thread
From: Ian Dall @ 2002-09-02  5:29 UTC (permalink / raw)
  To: Mike Laman; +Cc: GCC

"Mike Laman" <mlaman@cox.net> writes:

> I tried it. I still get the __main call.
> 
> Any other ideas?

Do you need to call your main "main"?

Ian

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-02  3:36           ` __main Mike Laman
@ 2002-09-02  5:51             ` Fergus Henderson
  2002-09-02 19:06               ` __main Mike Laman
  0 siblings, 1 reply; 18+ messages in thread
From: Fergus Henderson @ 2002-09-02  5:51 UTC (permalink / raw)
  To: Mike Laman; +Cc: GCC

On 02-Sep-2002, Mike Laman <mlaman@cox.net> wrote:
> Maybe I'm missing the point, but I think these issues are with the
> compiler - not the assembler. The assembler is already defined -
> such can be the life with cross compiling.

The issue could be a bug with a particular back-end port of the compiler.
If the system as a whole doesn't support symbols starting with an
underscore, then it is not a conforming C implementation.

Which port is it?  Is it one that is included in the FSF version of GCC?
Is it a port that you got from someone else?
Or is it a port that you are implementing yourself?

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-02  5:51             ` __main Fergus Henderson
@ 2002-09-02 19:06               ` Mike Laman
  2002-09-03 14:03                 ` __main Fergus Henderson
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Laman @ 2002-09-02 19:06 UTC (permalink / raw)
  To: GCC

Hi,

I'm creating the port (working on my third month on this project).
I'm certainly learning a lot, so I'm hoping most of these issues/items
will be resolved by something I've overlooked.
(Kind of easy to miss things sometimes - there's a lot to learn).

Good point on the underscores. Unfortunately the assembler is not very
conforming,
but I'm trying to work with what I have. I have the USER_LABEL_PREFIX
defined to get around some problems. I'm doing what I can.

Thanks,
Mike

----- Original Message -----
From: "Fergus Henderson" <fjh@cs.mu.OZ.AU>
To: "Mike Laman" <mlaman@cox.net>
Cc: "GCC" <gcc@gcc.gnu.org>
Sent: Monday, September 02, 2002 5:51 AM
Subject: Re: __main


> On 02-Sep-2002, Mike Laman <mlaman@cox.net> wrote:
> > Maybe I'm missing the point, but I think these issues are with the
> > compiler - not the assembler. The assembler is already defined -
> > such can be the life with cross compiling.
>
> The issue could be a bug with a particular back-end port of the compiler.
> If the system as a whole doesn't support symbols starting with an
> underscore, then it is not a conforming C implementation.
>
> Which port is it?  Is it one that is included in the FSF version of GCC?
> Is it a port that you got from someone else?
> Or is it a port that you are implementing yourself?
>
> --
> Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the
pursuit
> The University of Melbourne         |  of excellence is a lethal habit"
> WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-02  5:29           ` __main Ian Dall
@ 2002-09-02 19:08             ` Mike Laman
  0 siblings, 0 replies; 18+ messages in thread
From: Mike Laman @ 2002-09-02 19:08 UTC (permalink / raw)
  To: GCC

Hi Ian,

I'd really like to call main "main". The more conforming, the better.
The less exceptions/restrictions/issues/problems/features the better.

Thanks,
Mike
----- Original Message ----- 
From: "Ian Dall" <ian@beware.dropbear.id.au>
To: "Mike Laman" <mlaman@cox.net>
Cc: "GCC" <gcc@gcc.gnu.org>
Sent: Monday, September 02, 2002 5:29 AM
Subject: Re: __main


> "Mike Laman" <mlaman@cox.net> writes:
> 
> > I tried it. I still get the __main call.
> > 
> > Any other ideas?
> 
> Do you need to call your main "main"?
> 
> Ian
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-08-29 22:18   ` __main Mike Laman
  2002-09-01  9:04     ` __main Fergus Henderson
@ 2002-09-02 19:37     ` Zack Weinberg
  1 sibling, 0 replies; 18+ messages in thread
From: Zack Weinberg @ 2002-09-02 19:37 UTC (permalink / raw)
  To: Mike Laman; +Cc: GCC

On Thu, Aug 29, 2002 at 10:20:29PM -0700, Mike Laman wrote:
> When running a C cross compiler where one does not want a call
> to "__main()" to be emitted, how can one turn it off?

You need to get HAS_INIT_SECTION defined.  The appropriate way to
do that is to use ELF for your object format, and write your target
configuration headers accordingly.

zw

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-02 19:06               ` __main Mike Laman
@ 2002-09-03 14:03                 ` Fergus Henderson
  2002-09-03 14:21                   ` __main Neil Booth
  0 siblings, 1 reply; 18+ messages in thread
From: Fergus Henderson @ 2002-09-03 14:03 UTC (permalink / raw)
  To: Mike Laman; +Cc: GCC

On 02-Sep-2002, Mike Laman <mlaman@cox.net> wrote:
> I'm creating the port (working on my third month on this project).

In that case, why don't you define NAME__MAIN and SYMBOL__MAIN
in your target header files?

("set NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
give the same symbol without quotes for an alternative entry point.
You must define both, or neither.")

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-03 14:03                 ` __main Fergus Henderson
@ 2002-09-03 14:21                   ` Neil Booth
  2002-09-04  4:03                     ` __main Richard Earnshaw
  0 siblings, 1 reply; 18+ messages in thread
From: Neil Booth @ 2002-09-03 14:21 UTC (permalink / raw)
  To: Fergus Henderson; +Cc: Mike Laman, GCC

Fergus Henderson wrote:-

> On 02-Sep-2002, Mike Laman <mlaman@cox.net> wrote:
> > I'm creating the port (working on my third month on this project).
> 
> In that case, why don't you define NAME__MAIN and SYMBOL__MAIN
> in your target header files?
> 
> ("set NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
> give the same symbol without quotes for an alternative entry point.
> You must define both, or neither.")

Why not just define one in terms of the other?  I could never
figure that out.

Neil.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: __main
  2002-09-03 14:21                   ` __main Neil Booth
@ 2002-09-04  4:03                     ` Richard Earnshaw
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Earnshaw @ 2002-09-04  4:03 UTC (permalink / raw)
  To: Neil Booth; +Cc: Fergus Henderson, Mike Laman, GCC, Richard.Earnshaw

> Fergus Henderson wrote:-
> 
> > On 02-Sep-2002, Mike Laman <mlaman@cox.net> wrote:
> > > I'm creating the port (working on my third month on this project).
> > 
> > In that case, why don't you define NAME__MAIN and SYMBOL__MAIN
> > in your target header files?
> > 
> > ("set NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
> > give the same symbol without quotes for an alternative entry point.
> > You must define both, or neither.")
> 
> Why not just define one in terms of the other?  I could never
> figure that out.

Oh probably because when I added that 10+ years ago there was some reason 
why we couldn't rely on being able to generate a string from a symbol; 
that is, why one of

#define STRINGIFY(X) #X

and

#define STRINGIFY(X) "X"

was failing, though you don't really expect me to remember that now do you?

R.

PS I've always condidered the K+R form a truly gross hack; there certainly 
was nothing in K+R1 that suggested this had to work.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2002-09-04 11:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-29 11:25 __main Robert Spanton
2002-08-29 11:40 ` __main Fergus Henderson
2002-08-29 22:18   ` __main Mike Laman
2002-09-01  9:04     ` __main Fergus Henderson
2002-09-01 13:14       ` __main Mike Laman
2002-09-01 13:22         ` __main Mike Laman
2002-09-01 13:40           ` __main Robert Spanton
2002-09-02  4:26             ` __main Lars Brinkhoff
2002-09-02  5:29           ` __main Ian Dall
2002-09-02 19:08             ` __main Mike Laman
2002-09-01 22:56         ` __main Fergus Henderson
2002-09-02  3:36           ` __main Mike Laman
2002-09-02  5:51             ` __main Fergus Henderson
2002-09-02 19:06               ` __main Mike Laman
2002-09-03 14:03                 ` __main Fergus Henderson
2002-09-03 14:21                   ` __main Neil Booth
2002-09-04  4:03                     ` __main Richard Earnshaw
2002-09-02 19:37     ` __main Zack Weinberg

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 read-only IMAP folder(s) and NNTP newsgroup(s).