On Mon, 19 Jan 2009 14:25:00 -0500, "Daniel Richard G." skunk@iSKUNK.ORG wrote:
On Mon, 2009 Jan 19 18:23:05 +0000, Nick Treleaven wrote:
- Various cases of foo() --> foo(void). (Come on guys... the only
excuse is if you're older than dirt and still haven't broken your old K&R habits :)
Or you are used to C++ or C99 ;-) My brain keeps saying the 'void' is redundant. But I updated my function snippet a while ago to do it for me usually.
It never hurts to make it explicit. In C, a prototype with empty parens is sort of like a "wildcard" that will be consistent with any same-named function prototype/definition that actually does give the
On a similar note, I recently experienced some nasty crashes when using the geanyvc and spellcheck plugn together. After some investigation, I figured that in geanyvc.c there was a function 'execute_command' which was not declared static and without prototype. No problem so far. But the spellcheck plugin uses enchant and enchant loads libvoikko which loads libmalaga and libmalaga also has a function 'execute_command'. So there was a clash between these symbols for some reason causing weird segfaults when using any command of geanyvc which calls its 'execute_command'. Frank fixed this in r380 and the morale of the story is: use static whenever possible :). Probably a prototype for 'execute_command' had also fixed the problem.
But the real problem is that gcc doesn't warn about it (or I haven't found an option for gcc 4.1 anyway).
-Wstrict-prototypes :-) The warning it gives you is "function declaration isn’t a prototype".
But this option is not much fun since it causes many, many warnings in GLib/GTK headers.
Regards, Enrico