Re: [AD] got rid of END_OF_MAIN()

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


On Aug 9, 2004, at 1:12 AM, Chris wrote:

I'm not actually sure what the concensus was, but I was told by Bobn on Allegro.cc that doing something like:
#define main \
_mangled_main(int, char **); \
int main(int argc, char **argv) \
{ \
   return _mangled_main(argc, argv); \
} \
int _mangled_main

was not something they wanted to do. And with good reason.

This isn't what the patch I submitted does.

I don't understand this. There's no need to make everything that's valid C be valid for Allegro. I mean, currently this:
int main(int argc, char *argv[])
{ whatever.... }
(without the END_OF_MAIN) is valid C but it doesn't work with Allegro.

Yes it does.. for systems that don't require any special processing, anyway.

Uh, well, that's still true with the patch I submitted. Those systems would not have to use argc and argv. Moreover, who cares? How many people write Allegro programs that:
A. Don't run on Windows, Unix, or Mac OS X, and
B. The author has a problem writing a main with argc and argv.


Because that'll soimply rename things called main to _mangled_main. Whereas a patch like the one I wrote above would insert arbitrary code and confuse the compiler. For example:

Why don't you take a look at the patch. Even with the patch it would STILL just rename things called main to _mangled_main. So what's the difference? What my patch does is has a
#define main _mangled_main

and then elsewhere it has a declaration for a function _mangled_main like this:
int _mangled_main(int argc, char *argv[]);

Mike Benfield





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