int main() vs void main() in esp-idf examples
Posted: Tue Feb 05, 2019 5:37 pm
Hello,
I'm a C beginner (actually away for 15 years) and after a bunch of reading I think I have an answer, but would like a confirmation...
In the ESP-IDF example programs, like hello_world, the main functions start with void app_main(), instead of int main(). From what I gather, this is just a choice the Espressif developers made, and could have just as easily used int main(), and a return(0) at the end. Is this correct?
To be clear, I don't mean the difference between the wording "main" and app_main", but the choice to use "void" instead of "int".
If it is a choice, does anyone know why it was made? Google searches find many developers who do not like void main() at all, since they consider it "non-standard".
You're feedback is appreciated.
I'm a C beginner (actually away for 15 years) and after a bunch of reading I think I have an answer, but would like a confirmation...
In the ESP-IDF example programs, like hello_world, the main functions start with void app_main(), instead of int main(). From what I gather, this is just a choice the Espressif developers made, and could have just as easily used int main(), and a return(0) at the end. Is this correct?
To be clear, I don't mean the difference between the wording "main" and app_main", but the choice to use "void" instead of "int".
If it is a choice, does anyone know why it was made? Google searches find many developers who do not like void main() at all, since they consider it "non-standard".
You're feedback is appreciated.