Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [commit] new observer.[hc] files
Date: Fri, 28 Feb 2003 16:14:00 -0000	[thread overview]
Message-ID: <3E5F8B86.9080902@redhat.com> (raw)
In-Reply-To: <20030228152256.GB23109@nevyn.them.org>

> 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.

Like the PowerABI?  That has a 32 bit pointer but a 64 bit function 
descriptor.  void* ends up containing the address of the function 
descriptor.  Anyway, "defs.h" has the comment:

/* NOTE: cagney/2000-03-04: This typedef is strictly for the
    make_cleanup function declarations below. Do not use this typedef
    as a cast when passing functions into the make_cleanup() code.
    Instead either use a bounce function or add a wrapper function.
    Calling a f(char*) function with f(void*) is non-portable. */
typedef void (make_cleanup_ftype) (void *);

Once the code gets converted into a SED script, it can always be changed 
to something more strict.

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

Per the original thread, it is to ensure strongly typed interfaces.

Andrew



  parent reply	other threads:[~2003-02-28 16:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-28  7:38 Joel Brobecker
2003-02-28 15:22 ` Daniel Jacobowitz
2003-02-28 16:10   ` Andreas Schwab
2003-02-28 16:14   ` Andrew Cagney [this message]
2003-02-28 16:39     ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E5F8B86.9080902@redhat.com \
    --to=ac131313@redhat.com \
    --cc=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox