Hey Guilers, Andy and Ludo and I were discussing this on IRC and it was suggested that we move the question to the mailing list. I'm trying to compile some code -- using `gcc -pedantic' -- that invokes `scm_c_make_gsubr', and I'm getting the following warning:
warning: ISO C forbids passing argument 5 of ‘scm_c_make_gsubr’ between function pointer and ‘void *’ [-pedantic] /usr/local/include/guile/2.0/libguile/gsubr.h:63:13: note: expected ‘scm_t_subr’ but argument is of type ‘struct scm_unused_struct * (*)(struct scm_unused_struct *, struct scm_unused_struct *)’ I was confused, because I was sure that Guile defines scm_t_subr as `SCM (*) ()', meaning that an `scm_t_subr' is of unspecified arity. And I was right, but only at libguile compilation time. From __scm.h: #ifdef BUILDING_LIBGUILE typedef SCM (* scm_t_subr) (); #else typedef void *scm_t_subr; #endif Thus the warning: ISO C lets you cast any kind of pointer to `void *' -- except for a function pointer. Ludovic suggested that this bit of preprocessor magic exists to support C++, in which the `()' style of function prototyping is equivalent to `(void)'. But that leaves people like me who want to be, well, pedantic, in a tough spot. Is there anything we can do about this? One thing I was thinking was that we could support the C++ case (and others) more explicitly. E.g.: #ifdef __cplusplus typedef void *scm_t_subr #else typedef SCM (* scm_t_subr) (); #endif What do you think? Regards, Julian