Re: [gtk-list] Why strings? (was Re: GTK problem)
- From: Trever Adams <arabian onramp net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Why strings? (was Re: GTK problem)
- Date: Tue, 07 Apr 1998 19:25:54 -0500
Owen Taylor wrote:
> Trever Adams <arabian@onramp.net> writes:
>
> > Below is a segment of code that seems like the hard way of doing
> > something. Notice the strings "changed" "clicked" and "value_changed"
> > in this code fragment and your own code. Why do we use strings instead
> > of constants/defines? It takes more to compare strings than constants.
> > Is there a good reason to do it this way instead?
>
> By using hash tables, the performance hit from looking things up
> by strings is quite small. (And note that the string => id lookup
> does not occur every time a signal is called, but usually only
> when you _connect() the signal).
>
> Regards,
> Owen
>
Then other than some startup slowness and screen creation, and a bit of bulk in
executable size I guess there is no reason to change it if indeed string => id
happens very seldom.
Thank you for the prompt reply.
Trever
arabian@onramp.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]