3 ms·
Why not just use int main(void)?
by shawxe 7y ago
Why not just use int main(void)?
- deleted 7y ago[deleted]
- mkehrt 7y agoI'm confused. main doesn't take void--it takes two arguments. The f() syntax means that the definition doesn't specify how many arguments the function will be called with, while f(void) means it takes no arguments.
- pksadiq 7y agoAs per the standard, main() can take no argument [ie, main(void)] or 2 arguments [main (int, char asterisk asterisk) or equivalent] or some implementation defined manner. See 5.1.2.2.1 in C2x working draft[0]. [0] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2346.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2346.pdf
- tropo 7y agoWow, it is painful to see that they still haven't accepted case ranges. They are supported by gcc, clang, and icc. Like so: case 123 ... 456: Switching on strings is another thing people have been wanting for half a century. It would seep up many programs, because most programmers don't bother to generate a perfect hash or a carefully-balanced tree of "if".