C main function
This cluster centers on debates about the proper signature, return type, and standards compliance of the main() function in C programs, including void main(), implicit returns, entry points, and freestanding environments.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Is it undefined behavior to have main be anything other than a function that returns int?
That kind of assumes you have a main() function.
Are you trying to dispute the fact that `main()` is THE entry point for any C program? I'd be interested in hearing a more comprehensive explanation.
Why not just use int main(void)?
Ah, I guess it's just main that implicitly returns 0.
You could make main() a standard C function that merely calls this machine code hack function.
Ah, the days of void main(void)
Anything that has 'void main' isn't quite up to snuff, to begin with.
on similar lines, i find this http://jroweboy.github.io/c/asm/2015/01/26/when-is-main-not-... quite entertaining !
The function called at program startup is named main, which this translation unit defines. No other may therefore define it. Binaries that don't run main are out of the scope of the standard, and so irrelevant to the discussion.Anyway, as a more general point: your argument is, basically, "the customer is wrong". But the customer is never wrong! Therefore your argument is invalid.