2 ms·
At a guess, it makes the language simpler. The main function is just that -- a function. It uses tools the language already has to deal with arguments and exit
by pdehaan 6y ago
At a guess, it makes the language simpler. The main function is just that -- a function. It uses tools the language already has to deal with arguments and exit codes.
Arguably it also keeps things like libraries simpler. For example, what would it mean for me to have top-level expressions in a dynamic shared library? Does it execute as soon as I dlopen() it? Does it create an implicit "init" function that I need to call?
- heavenlyblue 6y agoUm, DLLs have it. I used it to inject my own code in foreign executables.
- pdehaan 6y agoThanks, that's new to me (or at least I've ignored it long enough to have forgotten if I had learned it before).