3 ms·
The only reason to have a return value for main() is if you yourself care, and sometimes you might. For my real time operating system class I have a Startup.s f
by Jach 16y ago
The only reason to have a return value for main() is if you yourself care, and sometimes you might. For my real time operating system class I have a Startup.s file that ends up calling the OS's main(), and while I don't care about its return value I might want to flash certain LEDs if it returned something other than 0. If I had to ship it I also might want to make it log something to some persistent memory (like an SD card) so I could debug a customer's problem without being there with a debugger under the same circumstances. Also I'm working on getting dynamic applications on the system, and the OS might be interested in their return values.