Declare cfunction.fptr as jv (*)() to avoid having to cast everywhere
You only need to specify the return type in a function pointer declaration in C. If you use () in the declaration, the function pointer can be called with any arguments, and the type of the arguments is decided for each function call based on the types of the arguments used for the call. (To declare a function pointer for a function with no arguments, you use `(void)'.) Since all the cfunction structs have a fptr that points to a functions that return jv, not void, we can we can just declare cfunction.fptr as jv (*)() and avoid having those annoying and technically not C-standard compliant casts everywhere.
This commit is contained in:
1 parent
f61f842ad0
commit
6716e23ae6
4 files changed
+81
-88
No files matched your search
+1
-2
@@ -20,8 +20,7 @@ LIBJQ_SRC = src/builtin.c src/bytecode.c src/compile.c src/execute.c \
|
||||
### C build options
|
||||
|
||||
AM_CFLAGS = -Wextra -Wall -Wno-missing-field-initializers \
|
||||
-Wno-unused-parameter -Wno-unused-function \
|
||||
-Wno-cast-function-type
|
||||
-Wno-unused-parameter -Wno-unused-function
|
||||
|
||||
if WIN32
|
||||
AM_CFLAGS += -municode
|
||||
|
||||
Reference in new issue
Block a user