Re: g_utf8_validate() and NUL characters

Dan Winship wrote:
> Maciej Katafiasz wrote:
>> Den Tue, 07 Oct 2008 16:55:29 -0400 skrev Behdad Esfahbod:
>>> Ugh.  Why is that?  Who knows?  Matthias suggested that because a string
>>> claiming to be length bytes long but terminating prematurely is not
>>> valid. However, that statement assumes that string is nul-terminated.
>> That is indeed very ugly, and seems to me like a particularly unfortunate 
>> case of implementation guts spilling out onto the public API and then 
>> getting documented as invariants :(. Personally I can't think of a single 
>> reason not to allow NULs if that was the consistent design decision 
>> across the stack;
> Sure, but the lower levels of the C stack have already established the
> rule that a char * is assumed to be NUL-terminated, and methods that
> take both a char * and a length (strncpy(), strncmp(), strndup(), etc)
> do so to let you stop before the NUL, not to let you keep going after
> the NUL.

Sure, but then there's memcpy, memcmp, memdup, etc for the other behavior.


> -- Dan
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org

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