4 ms·
GCC (as an example) turns () and ( void ) into the exact same output. I have some memory of long, long ago entering the world of C in the hands of the DICE comp
by hackermom 16y ago
GCC (as an example) turns () and ( void ) into the exact same output. I have some memory of long, long ago entering the world of C in the hands of the DICE compiler for the Amiga, that being clear in the declaration of functions is The Right Way: say void, or say inputs. Semantically I consider ( void ) to simply say "in this case, we're not going to be using any input vectors", rather than "this function can never have inputs; it's not supported". Clarity is never wrong.
- zokier 16y agomain is a special case, but generally () and (void) are different, void meaning that the function cannot have any parameters and empty allowing any number of arguments. Therefore imho is clearer to use main() rather than main(void), indicating that there may be parameters, but we don't care. http://codepad.org/UGLG7yRm http://codepad.org/UGLG7yRm and http://codepad.org/w2GyTkB1 http://codepad.org/w2GyTkB1