Re: Call signature of Gtk2::MessageDialog->new
- From: muppet <scott asofyet org>
- To: Bjarne Steinsbø <bosteins broadpark no>
- Cc: gtk-perl list <gtk-perl-list gnome org>
- Subject: Re: Call signature of Gtk2::MessageDialog->new
- Date: Thu, 27 Nov 2003 08:37:05 -0500
On Thursday, November 27, 2003, at 06:57 AM, Bjarne Steinsbø wrote:
From C, the message part is a printf()-style format string, with
additional arguments allowed for the sprintf.
Now, even I can understand why you don't want to pass the varargs
through to gtk+, you would have to parse the format string in order to
determine what data types to map the additional arguments to.
the problem is that gtk+ doesn't offer a vararg version of any
messagedialog functions. i think their rationale is that they are
convenience functions and we don't really *need* it, but even from C
you get the danger of embedded %s causing problems.
without the ability to pass varargs directly through, my rationale was
"hey, Perl's string handling is better than C's, why do we need varargs
on this at all?"
The one remaining problem (which is also present in the current
implementation) is that any '%' in the string would be interpreted by
the sprintf in gtk+ as a go-ahead to eat up more arguments, worst case
dumping core and best case producing garbage.
this is the actual problem. in fact, this has been on my todo list for
about two weeks, you've just beaten me to it. ;-)
So, how about calling gtk+ as:
... (parent, flags, type, buttons, '%s', result_of_perl_sprintf);
sv_vsetpvfn is our friend. i don't like running the string through
'%s' but i guess we have no choice, general calrissian.
ok, off to eat turkey with my family.
--
muppet <scott at asofyet dot org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]