pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tatsuo Ishii <ishii@postgresql.org>
To: pgsql@j-davis.com
Cc: pgsql-hackers@postgresql.org
Subject: Re: C11: should we use char32_t for unicode code points?
Date: Fri, 24 Oct 2025 18:43:15 +0900 (JST)
Message-ID: <20251024.184315.1449345234035166124.ishii@postgresql.org> (raw)
In-Reply-To: <bedcc93d06203dfd89815b10f815ca2de8626e85.camel@j-davis.com>
References: <bedcc93d06203dfd89815b10f815ca2de8626e85.camel@j-davis.com>

> Now that we're using C11, should we use char32_t for unicode code
> points?
> 
> Right now, we use pg_wchar for two purposes: 
> 
>   1. to abstract away some problems with wchar_t on platforms where
> it's 16 bits; and
>   2. hold unicode code point values
> 
> In UTF8, they are are equivalent and can be freely cast back and forth,
> but not necessarily in other encodings. That can be confusing in some
> contexts. Attached is a patch to use char32_t for the second purpose.
> 
> Both are equivalent to uint32, so there's no functional change and no
> actual typechecking, it's just for readability.
> 
> Is this helpful, or needless code churn?

Unless char32_t is solely used for the Unicode code point data, I
think it would be better to define something like "pg_unicode" and use
it instead of directly using char32_t because it would be cleaner for
code readers.

Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp





view thread (18+ messages)  latest in thread

Message-ID: <20251024.184315.1449345234035166124.ishii@postgresql.org>
Permalink:  ../20251024.184315.1449345234035166124.ishii@postgresql.org/
Also on:    postgresql.org/message-id/20251024.184315.1449345234035166124.ishii@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: ishii@postgresql.org, pgsql@j-davis.com
  Subject: Re: C11: should we use char32_t for unicode code points?
  In-Reply-To: <20251024.184315.1449345234035166124.ishii@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox