From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | Kurt Roeckx <Q(at)ping(dot)be> |
Cc: | Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Walker/mutator prototype. |
Date: | 2003-12-14 16:52:20 |
Message-ID: | 87n09vuyt7.fsf@stark.dyndns.tv |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Kurt Roeckx <Q(at)ping(dot)be> writes:
> I did start by changing all the context's to void *, but you'll
> loose the real type that it gets called with, so the other calls
> will not generate warnings anymore because of wrong type.
But at least you'll get a warning if someone passes a non-pointer or an
incorrect number of arguments altogether.
> So I just casted the function pointers to the right type.
But that means you'll *never* get a warning. Even if someone passes a function
that's completely inappropriate. That seems worse than the disease.
Plus it's simply wrong since the compiler might actually invoke the function
incorrectly. When you call the function you have to call it through a function
pointer with the same type as the prototype the function was defined with to
guarantee all the casts are performed and the proper calling convention is
followed.
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2003-12-14 21:06:26 | Re: fork/exec patch |
Previous Message | Bruno Wolff III | 2003-12-14 14:40:30 | Re: ORDER BY and DISTINCT ON |