mathiasbynens / small

Smallest possible syntactically valid files of different types
https://mathiasbynens.be/notes/minimal-html
1.93k stars 184 forks source link

c.c is invalid #60

Open intosi opened 8 years ago

intosi commented 8 years ago

Exporting an int as 'main' is not a legal C program. This will crash with a bus error on OS X, SEGV on Debian 8 and FreeBSD 10.

mathiasbynens commented 8 years ago

Did you see https://github.com/mathiasbynens/small/issues/39? CC @matheus28

intosi commented 8 years ago

Fair enough, but then the following C file is equally valid, as you may apparently ignore warnings, and int is implicit if no type is specified:

main;

catsmells commented 5 years ago

Exporting an int as 'main' is not a legal C program. This will crash with a bus error on OS X, SEGV on Debian 8 and FreeBSD 10.

yeah but it works

angleKH commented 3 years ago

Fair enough, but then the following C file is equally valid, as you may apparently ignore warnings, and int is implicit if no type is specified:

main;

The so-called implicit int rule doesn't exist anywhere in the current C standards, and came from a time before C was standardized, so just using main; would be invalid. However, I agree that the current int main; is also problematic, so you might be interested in #87.