[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Locale-independent paragraph formatting
From: |
Eli Zaretskii |
Subject: |
Re: Locale-independent paragraph formatting |
Date: |
Fri, 10 Nov 2023 08:47:10 +0200 |
> From: Gavin Smith <gavinsmith0123@gmail.com>
> Date: Thu, 9 Nov 2023 21:26:11 +0000
>
> I have just pushed a commit (e3a28cc9bf) to use gnulib/libunistring
> functions instead of the locale-dependent functions mbrtowc and wcwidth.
> This allows for a significant simplification as we do not have to try
> to switch to a UTF-8 encoded locale.
>
> I was not sure about how to put a char32_t literal in the source code.
> For example, where we previously had L'a' as a literal wchar_t letter 'a',
> I changed this to U'a'. I could not find very much information about this
> online or whether this would be widely supported by C compilers. The U prefix
> for char32_t is mentioned in a copy of the C11 standard I found online and
> also in a C23 draft.
I have MinGW GCC 9.2 here, and it supports U'a'. But I don't think we
need it, we could just use 'a' instead, see below.
OTOH, the char32_t type is not supported by this GCC, not even if I
use -std=gnu2x. Maybe we should use uint_least32_t instead?
> Does anybody know if we could just write 'a' instead of U'a' and rely
> on it being converted?
>
> E.g. if you do
>
> char32_t c = 'a';
>
> then afterwards, c should be equal to 97 (ASCII value of 'a').
Why not? What could be the problems with using this?