logoalt Hacker News

tedunangstyesterday at 8:32 PM2 repliesview on HN

This is incorrect. In a function definition, an empty list means it takes no parameters. 6.7.5.3 Function declarators

> 14. An empty list in a function declarator that is part of a definition of that function specifies that the function has no parameters.


Replies

zombottoday at 8:17 AM

"has no parameters" is not the same as "cannot take arguments". Defining `int main()` does not stop the runtime from passing the usual 3 arguments (typically named argc, argv, envp), it only means that no parameters are bound to those arguments. Technically it's no problem to have a C function ignore its arguments by not binding parameters. Way too many programmers seem to not understand the difference between parameter and argument.

https://stackoverflow.com/questions/156767/whats-the-differe...

show 2 replies
s3grahamyesterday at 9:20 PM

As you surely know if you're quoting the standard, it depends on which standard!

show 2 replies