Web lists-archives.com

Re: G_UTF8String: Boxed Type Proposal




Hi;

On 19 March 2016 at 18:03, Randall Sawyer <srandallsawyer@xxxxxxxxxxx> wrote:
> The concision of "GUString" over "G_UTF8String" reflects the concision of my
> thoughts over what they were at the beginning of this thread.

Since you've brought it up multiple times, I wanted to ensure you
understood this particular point...

GString is *not* a string type. It's a string builder type, heavily
modeled on StringBuilder in Java:

https://docs.oracle.com/javase/tutorial/java/data/buffers.html

GString is only meant to be used as a way to build strings from other
sources, not for storing or measuring strings.

The naming is a bit unfortunate, and has tricked various newcomers to
the G* platform libraries.

In general, especially for C developers, you're supposed to store
strings as NUL-terminated char*; for binary blobs, you should using a
uint8_t* with a length, instead. Those are the existing best practices
in the language, and are also used throughout the G* platform.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list