git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] clean: use f(void) instead of f() to declare a pointer to a function without arguments

From
René Scharfe <l.s.r@web.de>
Date
Aug 16, 2014, 11:16 UTC
Message-ID
<53EF3DA8.7040605@web.de>

Explicitly state that menu_item functions like clean_cmd don't take any arguments by using void instead of an empty parameter list.

Found using gcc -Wstrict-prototypes.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 builtin/clean.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/clean.c b/builtin/clean.c
index 1032563..3beeea6 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -67,7 +67,7 @@ struct menu_item {
 	char hotkey;
 	const char *title;
 	int selected;
-	int (*fn)();
+	int (*fn)(void);
 };
 
 enum menu_stuff_type {
-- 
2.1.0
Message 1 of 1 in “clean: use f(void) instead of f() to declare a pointer to a function without arguments”
  1. clean: use f(void) instead of f() to declare a pointer to a function without argumentsRené Scharfe, Aug 16, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.