On Sun, Oct 21, 2001 at 07:56:08PM +0100, Simon Cozens wrote:
> On Wed, Oct 10, 2001 at 11:27:24AM +0200, Paolo Molaro wrote:
> > ... and to go a step further in sanity and maintainability, I'd suggest
> > using a structure with properly typed function pointers instead of an
> > array:
> > 
> > typedef void (*parrot_pmc_add)     (PMC *dest, PMC *a, PMC *b);
> > typedef void (*parrot_pmc_dispose) (PMC *cookie);
> > ...
> 
> I've now changed the vtable structure to reflect this, but I'd like someone to
> confirm that the "variant" forms of the ops can be addressed the way I think
> they can. (ie. structure->base_element + 1 to get "thing after base_element")

If you mean vtable->add_1 + 1 gives you vtable->add_2, no. Pointer arithmetic
on a function pointer is not meaningful. You probably want to use an array of
function pointers for each method, like add[7] and initialize each entry
with the appropriate function pointer.

-- 
Jason

Reply via email to