Re: ignoring arguments is portable?



Joshua N Pritikin <vishnu pobox com> writes:

foo.c:
  void f(gint ok)
  { g_print("%d\n"); }

bar.c:
  extern void f(gint, gint, gint, gint);
  void g()
  { f(1,2,3,4); }

Can i do this?

The reason i'm asking is that i still can't reliably predict which arguments
are delivered by a given signal.  However, i'm usually only interested
in the first or second argument so maybe i can ignore the rest?  It works
on i386-linux.  :-)

Yes, it is portable, except to platforms that you almost certainly aren't
using.

(It isn't guaranteed by the C standard, but, practically speaking, it
works on all interesting platforms, and GTK+ depends on this internally.)

As for predicting signal args -- you can do this by reading the docs,
looking at the header files, or by querying the arguments using the
introspection facilities.

Regards,
                                        Owen




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