[Cs3] void vs empty brackets

Mikhail Nesterenko mikhail at cs.kent.edu
Mon Feb 10 14:23:08 EST 2014


CS3 students,

As it turns out, it is a holdover from C.

   int myfunc(void);
   int myfunc();

mean different things in C (the first one means no parameters, the
second - unspecified, possibly arbitrary number of parameters). In
C++ arbitrary number of parameters is not allowed (at least not this
way), therefore the above two function prototypes mean the same thing.
Moreover, stylistically people prefer not to include "void".


Thanks,
-- 
Mikhail


More information about the cs3 mailing list