This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [commit] new observer.[hc] files


On Thu, Feb 27, 2003 at 11:22:43PM -0800, Joel Brobecker wrote:
> As requested by Andrew in:
> http://sources.redhat.com/ml/gdb-patches/2003-02/msg00773.html
> 
> I checked the attached files in. There have slightly been modified from
> the file originally sent: added the copyright headers, some documentation,
> introduced the notion of subject from the "Design Patterns" book, added
> a missing "static" keyword for an internal function, etc.

> /* The internal generic observer.  */
> 
> typedef void (generic_observer_notification_ftype) (const void *data,
> 						    const void *args);
> 
> struct observer
> {
>   generic_observer_notification_ftype *notify;
>   /* No memory management needed for the following field for now.  */
>   void *data;
> };

> static void
> observer_normal_stop_notification_stub (const void *data,
> 					const void *unused_args)
> {
>   observer_normal_stop_ftype *notify = (observer_normal_stop_ftype *) data;
>   (*notify) ();
> }

Is this extra indirection really necessary?  Because I'm 99% sure it
won't work on several 64-bit platforms.  Function pointers and data
pointers are not required to have the same size; on IA-64 I believe
that a function pointer is 128 bits and a data pointer is 64 bits.

Why not require all observer functions to take the same arguments
instead?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]