Date: Wed, 25 Jun 2025 19:31:36 +0000
On 25/06/2025 17:18, Niall Douglas wrote:
>> I would fear that anything more complicated than a size_t is inviting
>> bugs and might prevent this from becoming a type that can easily
>> be used also by other languages.
>
> All major programming languages can speak C.
>
> If you want the length of one of these arrays, just call the C library
> function which will tell you.
>
> The encoding that the paper proposes is no more complicated than the
> UTF-8 encoding. If UTF-8 can be implemented bug free across multiple
> languages, so can this.
I've gone ahead and written out an implementation of the proposal at:
https://github.com/ned14/wg14_strings/blob/main/src/wg14_strings/impl.c
I think that looks straightforward enough. I'll add a test suite later.
Niall
>> I would fear that anything more complicated than a size_t is inviting
>> bugs and might prevent this from becoming a type that can easily
>> be used also by other languages.
>
> All major programming languages can speak C.
>
> If you want the length of one of these arrays, just call the C library
> function which will tell you.
>
> The encoding that the paper proposes is no more complicated than the
> UTF-8 encoding. If UTF-8 can be implemented bug free across multiple
> languages, so can this.
I've gone ahead and written out an implementation of the proposal at:
https://github.com/ned14/wg14_strings/blob/main/src/wg14_strings/impl.c
I think that looks straightforward enough. I'll add a test suite later.
Niall
Received on 2025-06-25 19:31:38