Re:How to dismantle a compiler bomb
by shakna on Friday March 09, 2018 @07:35PM
(#16556334)
> In fact, main() is just a convention of libc.
No, it's not just a convention. 'main' is defined as the execution entrypoint in at least the C11 [0], C90 [1] standards. Both have both these forms defined:
int main(void) {}
int main(int argc, char* argv[]) {}
You don't have to follow that convention, but then it becomes implementation-defined behaviour.
C without libc can still expect to have a main. One doesn't imply the other. It's just without a main, you also have to manually link to _start as well.
No, it's not just a convention. 'main' is defined as the execution entrypoint in at least the C11 [0], C90 [1] standards. Both have both these forms defined:
You don't have to follow that convention, but then it becomes implementation-defined behaviour.C without libc can still expect to have a main. One doesn't imply the other. It's just without a main, you also have to manually link to _start as well.
[0] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
[1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf