Hacker News new | past | comments | ask | show | jobs | submit login

In C function prototypes with no arguments are strange.

  void g();
Means that g is a function which takes a not-specified number of arguments (but not a variable number of arguments).

Almost always what you want to do is

  void g(void)
Which says that g takes 0 arguments.

Having said that, declaring it as g() should work fine as long as you always provided that you always invoke it with the correct arguments. If you try invoking it with the wrong arguments, then the compiler will let you, and your program may just break in fun and exciting ways.

Edit: looking closer, it looks like the intent might have been to alias f and g. But, as discussed above, it does so in a way that will break horribly if g expects any arguments.






Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: