Re: utf-16 and glib



On Mon, 2009-01-26 at 23:48 +0100, Martin (OPENGeoMap) wrote:
> 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:
> >> http://library.gnome.org/devel/glib/unstable/glib-Unicode-Manipulation.html#g-utf8-strncpy
> >>     
> >
> > 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.

But how many of them changes the meaning by other 'switch-macro'? I'm
nearly sure that all of them evaluate to the same values at each gived
platform.

> I believe que a C compiler is the right 
> place to this kind of unsafe code.

What do you mean by 'unsafe'? If the 'unsafe' code is unsafe there is no
place to put it. If the 'unsafe' means that the code cannot be verified
easily by compiler if it is correct that there is place in C code (or
any other).

> 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.

How much is the overhead? How big it is in compare to for example I/O in
accessing filesystem, drawing in access to GTK+ or to GC in access to
C#/Java?

> Besides modern GUIs 

You mean IDE not GUI.

> have support to understand what we have in 
> a MACRO. Visual c++ have that kind of support.
> 

Well. To begin with not everybody uses IDE. I'm happy with emacs. There
are people happy with gedit or vim. And, eventually, it doesn't matter
what IDE have support to. What programmer have support is the real
matter. And - finally - what IDE will do with included header? 

> Regards.
> 

Regards

Attachment: signature.asc
Description: This is a digitally signed message part



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