[En-Nut-Discussion] GCC and main

Nathan Moore nategoose at gmail.com
Tue Jan 26 19:44:40 CET 2010


There are several possible differences between main() and other functions.
Some come from the libc used and others from the compiler.  For instance,
it's not uncommon for a compiler to generate stack alignment code in main()
on targets that prefer 2, 4, or 8 byte alignment, but not in other functions.

Personally I dislike for main to be anything except:
int main(void)
int main(int argc, const char * argv[])
or
int main(int argc, const char * argv[], const char * envp[])
Which is not what Nut wants main to be.
Some compilers will bark at you for defining main with parameters that
are different
from this (well, signed and const could be changed).

I don't use the
#define main NutAppMain
in my code and just call it NutAppMain.


Nathan



More information about the En-Nut-Discussion mailing list