Re: utf-16 and glib

Dominic Lachowicz escribiÃ:
What is wrong with:
gchar*  g_utf8_strncpy  (gchar *dest,const gchar *src,gsize n);

That's one not needed as strncpy should work.

hehe i know but that function it really exist:

It does make sense. strncpy copies N bytes, when what you want to do
is copy N characters from a multi-byte encoded string. You don't want
to the copy to stop somewhere in the middle of a multi-byte character
sequence because the result simply wouldn't make sense.

and the macro:
gtext*  g_text_strncpy  (gtext*dest,const gtext*src,gsize n);

Because having 2 implementations of a function and having 1
automatically chosen by a pre-processor macro is one of the worst API
decisions that Microsoft has ever made. And that's saying something.

Glib/gtk is full of macros. I believe que a C compiler is the right place to this kind of unsafe code. If i want create safe code i have c#,c++, JAVA, D or VALA. Using macros is the only way to ensure intermediate APIs donÂt have any overhead. Besides modern GUIs have support to understand what we have in a MACRO. Visual c++ have that kind of support.


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