Re: [RFC] timers, pointers to functions and type safety

2006-12-02 Thread Olivier Galibert
On Fri, Dec 01, 2006 at 07:57:51PM -0800, Andrew Pinski wrote: > On Fri, 2006-12-01 at 17:21 +, Al Viro wrote: > > 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 t

Re: [RFC] timers, pointers to functions and type safety

2006-12-02 Thread Joe Buck
On Fri, Dec 01, 2006 at 07:57:51PM -0800, Andrew Pinski wrote: > On Fri, 2006-12-01 at 17:21 +, 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

Re: [RFC] timers, pointers to functions and type safety

2006-12-02 Thread Thomas Gleixner
On Fri, 2006-12-01 at 17:21 +, Al Viro wrote: > Now, there's another question: how do we get there? Or, at least, from > current void (*)(unsigned long) to void (*)(void *)... I think the real solution should be void (*function)(struct timer_list *timer); and hand the timer itself

Re: [RFC] timers, pointers to functions and type safety

2006-12-02 Thread Al Viro
On Sat, Dec 02, 2006 at 04:23:32AM -0500, Kyle Moffett wrote: > On Dec 01, 2006, at 12:21:49, Al Viro wrote: > >And that's where it gets interesting. It would be very nice to get to > >the following situation: > > * callbacks are void (*)(void *) > > * data is void * > > * instances can take void

Re: [RFC] timers, pointers to functions and type safety

2006-12-02 Thread Al Viro
On Sat, Dec 02, 2006 at 01:29:32AM -0500, Daniel Berlin wrote: > >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. > > Understandable. I assume you are trying to get more type s

Re: [RFC] timers, pointers to functions and type safety

2006-12-02 Thread Arnd Bergmann
On Friday 01 December 2006 18:21, Al Viro wrote: >  There is a tempting > possibility to do that gradually, with all intermediates still in working > state, provided that on all platforms currently supported by the kernel > unsigned long and void * are indeed passed the same way (again, only for >

Re: [RFC] timers, pointers to functions and type safety

2006-12-02 Thread Kyle Moffett
On Dec 01, 2006, at 12:21:49, Al Viro wrote: And that's where it gets interesting. It would be very nice to get to the following situation: * callbacks are void (*)(void *) * data is void * * instances can take void * or pointer to object type * a macro SETUP_TIMER(timer, func, data) sets ca

Re: [RFC] timers, pointers to functions and type safety

2006-12-01 Thread Daniel Berlin
On 12/1/06, Al Viro <[EMAIL PROTECTED]> wrote: There's a bunch of related issues, some kernel, some gcc, thus the Cc from hell on that one. First of all, in theory the timers in kernel are done that way: * they have callback of type void (*)(unsigned long) * they have dat

Re: [RFC] timers, pointers to functions and type safety

2006-12-01 Thread David Daney
Andrew Pinski wrote: On Fri, 2006-12-01 at 17:21 +, 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

Re: [RFC] timers, pointers to functions and type safety

2006-12-01 Thread Andrew Pinski
On Fri, 2006-12-01 at 17:21 +, 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