guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH]-Wstrict-prototypes on SCM_FUNC_CAST_ARBITRARY_ARGS


From: Kevin Ryde
Subject: Re: [PATCH]-Wstrict-prototypes on SCM_FUNC_CAST_ARBITRARY_ARGS
Date: Sat, 14 Feb 2004 10:17:42 +1000
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

Stephen Compall <address@hidden> writes:
>
> Kevin Ryde <address@hidden> writes:
> > I wonder why a cast is needed at all.  I might have thought a
> > parameter "SCM (*)()" would be happly passed a function "SCM foo
> > (SCM x, SCM y)" or whatever.
>
> I believe this, however, would eliminate almost all the benefit of
> type-checking of function pointers in the first place.

I think it would let the return value get checked, which would be
advantageous, if it worked.  (It'd also do what you want to be safe to
-Wstrict-prototypes.)

Casting the function pointer (as done now) means it can be anything at
all, for instance someone could mistakenly give "void" for the return
if they didn't realize it should be an SCM (and return
SCM_UNSPECIFIED).

With no cast then the return value will have to be right, though of
course since the prototype is just "()" for the args they can be
anything.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]