Re: debug flags and g_type_init()
- From: Tim Janik <timj gtk org>
- To: Owen Taylor <otaylor redhat com>
- Cc: gtk-devel-list gtk org
- Subject: Re: debug flags and g_type_init()
- Date: Tue, 5 Jun 2001 23:05:42 +0200 (CEST)
On 5 Jun 2001, Owen Taylor wrote:
>
> Currently:
>
> - g_type_init() can be called multiple times
> - debug flags not set the first time will be silently ignored.
>
> So, in the rare case that someone wants to set the debug
> flags, they have to do:
>
> g_type_init (my_debug_flags);
>
> gtk_init (&argc, &argv);
right, unless they want debug flags parsed by gtk_init() take effect.
> Why not remove the debug flags argument to g_type_init()
> and have a separate g_type_set_debug_flags()? This has
> the advantages:
>
> - We omit the mysterious 0 from g_type_init(0)
> - We can put out a meaningful error if someone tries to
> set the debug flags after GType is initialized.
it also has disadvantages:
a) things break if _g_type_debug_flags is evaluated after
g_type_init() but before g_type_set_debug_flags() (currently
this will be triggered when initializing the gobject class).
for the future, we might even have per type-node debug info,
at that point debug flags have to be known right at g_type_init()
time (that's because g_type_init() already creates a couple type
nodes)
b) g_type_set_debug_flags() is yet another special function for the
user to remember, to call _before_ any other function, together
with (a), up to the extend of having to call g_type_set_debug_flags()
even before g_type_init()
c) not considering (a), your approach will cause the type system to
puke upon gtk_init() if the user enabled certain debugging beforehand
i don't think we can do much about not silently ignoring subsequent debug
settings, unless we introduce something like g_type_is_initialized() which
i think is taking the issue a bit to far.
if people really dislike the "mysterious" 0 to g_type_init, we could
however change things towards:
void g_type_init (void);
void g_type_init_with_debugging (GTypeDebugFlags debug_flags);
both would still have to be silent upon subsequent invokations however.
>
> Regards,
> Owen
>
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]