Web lists-archives.com

Re: G_UTF8String: Boxed Type Proposal




On 03/19/2016 02:57 PM, Emmanuele Bassi wrote:
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...

...

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.


I do understand that. Thank you.

What I am proposing is a means of combining a true string with its byte-length AND its utf8-length - thus eliminating the need for redundant calculations.

If there already were such a structure, then it could already have been employed by existing objects and structures such as GtkEntryBuffer and PangoLayout - to name two - eliminating the need for extra lines of redundant code. In fact - as I envision it - the entirety of struct _GtkEntryBuffer IS a GUString - and all of the procedures which operate upon instances of that structure could be performed by g_ustring_*() functions!

The emergence of such a structure may, IMHO, facilitate more rapid development of future structures and objects which could also benefit from having such a length-aware string object. That's all.


-------- Forwarded Message --------
Subject: Re: G_UTF8String: Boxed Type Proposal
Date: Sat, 19 Mar 2016 15:11:23 -0400
From: Randall Sawyer <srandallsawyer@xxxxxxxxxxx>
To: Emmanuele Bassi <ebassi@xxxxxxxxx>


On 03/19/2016 02:57 PM, Emmanuele Bassi wrote:
> 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...
>
> ...
>
> 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.
>

I do understand that. Thank you.

What I am proposing is a means of combining a true string with its 
byte-length AND its utf8-length - thus eliminating the need for 
redundant calculations.

If there already were such a structure, then it could already have been 
employed by existing objects and structures such as GtkEntryBuffer and 
PangoLayout - to name two - eliminating the need for extra lines of 
redundant code.

The emergence of such a structure may, IMHO, facilitate more rapid 
development of future structures and objects which could also benefit 
from having such a length-aware string object. That's all.



_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list