Re: [AD] Preparing for 4.9.9

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, 2009-03-09 at 18:24 -0700, Evert Glebbeek wrote:
> > However, as Allegro programs are not normal C programs - under  
> > Windows,
> > they really use WinMain() and not main(),
> 
> I think there's a patch to change this?

You mean an option to MSVC/Mingw? I wouldn't know.

> > and under OSX the "main"
> > function just is a user thread function)
> 
> It still uses a regular main() though ;)

Yeah - but it's not the function the user writes.

> > - I think *not* naming the
> > function "main" actually is the better thing to do. Why make users
> > believe they use main() when they don't.
> 
> We can argue over that if you like. :)

Of course. It's the main issue here. Leaving out the separate library
idea for now and after you solved my parameters problem below, it's
really just about which we prefer :)

Basically, with Allegro the library contains the real C main function
(with the A4, the SDL as well as the al_main solution) and the user just
provides a function which will be called by Allegro (of course except in
Linux because it neither has a different name for the program entry
point function nor does it require event handling to be done from the
main thread). The question is, is there really a benefit from hiding
this from users of the Library.

> > About the arguments of the function, it's not possible to allow "int
> > al_main(int argc, char **argv)" as well as "int al_main(void)". So  
> > we'd
> > have to choose one.
> 
> There's probably an obvious reason why this has to be so, but I can't  
> say I see what it is specifically: if you #define main allegro_main,  
> and then in the file that has the actual main() you "extern void  
> allegro_main(int, char **)", what exactly goes wrong?

Indeed, at least this had a very simple solution. I'll update the patch
to do it :)

> > As I said in the past, sticking a completely out-of-place looking  
> > macro
> > at the end of the functions seems to be a much more horrible thing  
> > to do
> > to me. While the upper part of the function in A4 looks like the  
> > normal
> > C main() - as a whole it makes programs look much less like normal C
> > code than if simply using al_main() and no macro.
> 
> Again, we can argue about this. At best though, they are equally un-C  
> like in that neither of those looks like a normal C program.

Well. In C, a function ends like this:

}

And not like this:

}
END_OF_MAIN()

So from a syntactical point of view, END_OF_MAIN is the only one which
does not look like C.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/