Re: Unicode and C++



> The frequency of loading/saving a file is substantially less than
> the frequency of gtk_label_set_text() in your average GUI app.

Ah. 

Then it makes perfect sense to use wide-characters, since there will
then be no conversion involved for this task, which can actually
result in quite a perfomance gain.

Especially for things like the pike GTK library wrapper, currently it
will work like this (simplified pseudocode...):

void pgtk_gtk_label_set_text( )
{
   struct pike_string *s = get_string_arg();
   char *tmp = malloc( enough_bytes_for_utf8( s ) );
   string_to_utf8( s, tmp );
   gtk_label_set_text( GTK_LABEL( THIS->obj ), tmp );
   free( tmp );
}


Also, many gtk_label_set_text use values from the system, such as
usernames etc, so there will still have to be conversion done (this is
not an issue for the pike wrapper, but will be for normal C-applications).


-- 
Per Hedbor                              http://per.hedbor.org/





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