[Top][All Lists]

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

Re: Handlers

From: Marco Gerards
Subject: Re: Handlers
Date: Sat, 30 Aug 2008 03:27:08 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Vesa Jääskeläinen <address@hidden> writes:

> Marco Gerards wrote:
>> If I knew a better way, I would have used it.  I think the
>> alternatives will all end up in either code duplication or a loss of
>> type safety that now is at least present through warnings.  But please
>> understand that you only have to use the macros, not change them :-)
>> Suggestions are welcome.
> Hi,
> Well... How about something like this?

This code does not describe structs with function pointers but structs
with data.  Furthermore, you made it very generic while you do need
casts.  For example, you have a generic iterate function.  Except for
the macros, this code is not too different.  But I used the macros to
glue the list code to the other code of GRUB, which is what you left
out.  But this is the essence of the discussion.

> It only requires one cast and no macros at all.

My code also contained generic code in kern/handler.c like your code.
I have added the macros to avoid casts.  This code will not work
directly in GRUB 2 for filesystems or whatever.  You need to cast at
some points, or even quite often.  And that is *exactly* what I would
like to avoid.


reply via email to

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