On Fri, 2006-12-01 at 17:21 +0000, Al Viro wrote:
>       There's a bunch of related issues, some kernel, some gcc,
> thus the Cc from hell on that one.

I don't really see how this is a GCC question, rather I see this
as a C question which means this should have gone to either
[EMAIL PROTECTED] or the C news group.


> While that is safe (modulo the portability constraint that affects much
> more code than just timers), it ends up very inconvenient and leads to
> lousy type safety.
Why do you say is inconvenient, that shows up all the time in real
code :).

> The thing is, absolute majority of callbacks really want a pointer to
> some object.  There is a handful of cases where we really want a genuine
> number - not a pointer cast to unsigned long, not an index in array, etc.
> They certainly can be dealt with.  Nearly a thousand of other instances
> definitely want pointers.

Then create an union which contains the two different types of call
back.
You know:
union a
{
  void (*callbackwithulong) (unsigned long);
  void (*callbackwithptr) (void*);
};

And then you just use the correct in the correct place.

I don't see why there is a mystery about this?

Thanks,
Andrew Pinski

PS don't cross post and I still don't see a GCC development question in
here, only a C one.




Reply via email to