Re: [gnet-dev] Callback arguments in GNet



On Wed, 2002-08-14 at 12:18, David Helder wrote:
> I was writing up some documentation on async write and I noticed that GNet
> is fairly inconsistent on what should be the arguments in callback.

> [...]

> My leaning is more to option #1.  #1 may be easier for the programmer, but
> it requires us to keep a lot more state.  Besides, the programmer already
> has the data pointer which should be enough.  In #2, inetaddr in the
> callback is actually a copy of the inetaddr passed in the original
> function.  (Hmm, really it could be a ref, but then I'd have to add
> mutexes.)

I'd go for option #1. It's common practice to not provide full context
for a callback, as it makes the interface cleaner. Most apps will need
to keep context through the data pointer anyway, to track what they're
doing.

-- 
Hans Petter



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