Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vCEKa-00ArJL-Uz for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Oct 2025 09:43:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vCEKZ-00F8K3-EY for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Oct 2025 09:43:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vCEKZ-00F8Jv-5L for pgsql-hackers@lists.postgresql.org; Fri, 24 Oct 2025 09:43:30 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vCEKV-003y9k-30 for pgsql-hackers@postgresql.org; Fri, 24 Oct 2025 09:43:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:Cc:To:Message-Id:Date:Sender :Reply-To:Content-ID:Content-Description; bh=SyqnFRPVtQ3hU9vO597sCjjDaGM6OT4Sblo/kvKQoUw=; b=1wvdXpfYw6c3s1rm9RttSyPcFY wwxi3EnzxWSFsX9pbLVoQBu6BXZRhsdIMW/DrzPnOZzUP/7Rjv1NlSIgtkLWe7rM0BEhvA+V3ZCt4 HEkc2ei9LTxuqk37DbohI/x/h0iSceKls2L/7ag16aQSMVZrKvR8TIMP26eBz6GfGQ2vWbflD5H1w DL0s6sr3+7ePVM3IOct3QO8vNRCtaXu0HAOBfXd812UvXS7zEikvyAGAXNl6BRxWk35p6RXxv3Ogg w+vpDIBwuI+YutRkGm0w4ZTMcg95eiplCil8kWl7jCpoAF1PwFdaGT3wUIojHADh9056UjwPr7lyM Yqu66f5w==; Received: from [2409:11:4120:300:eb47:43d3:7e7d:cee1] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vCEKT-009SLd-1Y; Fri, 24 Oct 2025 09:43:27 +0000 Date: Fri, 24 Oct 2025 18:43:15 +0900 (JST) Message-Id: <20251024.184315.1449345234035166124.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? From: Tatsuo Ishii In-Reply-To: References: X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:eb47:43d3:7e7d:cee1 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > Now that we're using C11, should we use char32_t for unicode code > points? > = > Right now, we use pg_wchar for two purposes:=A0 > = > 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 fort= h, > 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