Recently I came across this micro article where the following is stated:
- In your C program, you can have only one "main" function, whether it is called "main" or otherwise. If you use IPA, IPA will terminate with an error message issued when more than one "main" function is detected.
Do I understand correctly that the main
name (or some other name which is explicitly defined as a replacement of int main()
for an entry point) is an important part and, for example, I can have int main(int argc, char **argv)
and int sub_main(int argc, char **argv)
at the same program?
If not, and if there is a main
as part of the functions' names and/or (int argc, char **argv)
as parameters I might have a problem, will changing the places of the parameters to int sub_main(char **argv, int argc)
make any difference?
I haven't had problems so far so assume int main(int argc, char **argv)
and int sub_main(int argc, char **argv)
can happily coexist. Still, might be handy to know for sure.