public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <josmyers@redhat.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: Jason Merrill <jason@redhat.com>,
	Jonathan Wakely <jwakely.gcc@gmail.com>,
	 libstdc++@gcc.gnu.org, Ken Matsui <kmatsui@gcc.gnu.org>,
	 gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 01/14] c++: Implement __is_integral built-in trait
Date: Wed, 17 Jan 2024 11:28:22 +0000 (UTC)	[thread overview]
Message-ID: <d57bc8d-ab34-eee0-79d2-ee5d13322079@redhat.com> (raw)
In-Reply-To: <CACb0b4nzwJjgX2S78UpfSAAjBBkYTeBmLTGQ-YetBN3VmCJSzA@mail.gmail.com>

On Wed, 17 Jan 2024, Jonathan Wakely wrote:

> So we can remove the dependency on __STRICT_ISO__ for 128-bit integer
> types, and implementing std::is_integral with a built-in seems like
> the perfect time to do that. But that seems like stage 1 material, as
> we need to go through the library and see what needs to change.

As noted on IRC, for C23 there would also be library issues in making 
__int128 an extended integer type.  If it's an extended integer type, then 
C23 would require <stdint.h> to define int128_t, uint128_t, int_least128_t 
and uint_least128_t, along with the macros INT128_WIDTH, UINT128_WIDTH, 
INT_LEAST128_WIDTH, UINT_LEAST128_WIDTH (trivial), and INT128_C and 
UINT128_C (require an integer constant suffix), and INT128_MAX, 
INT128_MIN, UINT128_MAX, INT_LEAST128_MAX, INT_LEAST128_MIN, 
UINT_LEAST128_MAX (most simply defined using an integer constant suffix, 
though don't strictly require one).  And <inttypes.h> would have to define 
all the printf and scanf format macros for int128_t, uint128_t, 
int_least128_t and uint_least128_t - so library support would be needed 
for those (the format macros themselves should probably expand to "w128d" 
and similar, a C23 feature already supported for narrower types by glibc 
and by GCC format checking, rather than inventing new features there).

So because an extended integer type (without padding bits) in C23 is 
expected to have all the library support from <stdint.h> and <inttypes.h>, 
you need integer constant suffixes and printf/scanf support before you can 
declare __int128 an extended integer type for C23.

(If adding printf and scanf support for int128_t to glibc, it probably 
makes sense to add user-visible functions such as strtoi128 at the same 
time - no such functions are in the standard, but something like them 
would be needed internally as part of the scanf implementation, and it's 
likely they would be useful for users as well.)

-- 
Joseph S. Myers
josmyers@redhat.com


  reply	other threads:[~2024-01-17 11:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
2024-01-10  9:22 ` [PATCH 01/14] c++: Implement __is_integral built-in trait Ken Matsui
2024-01-17  0:30   ` Jason Merrill
2024-01-17  7:42     ` Jonathan Wakely
2024-01-17 11:28       ` Joseph Myers [this message]
2024-01-10  9:22 ` [PATCH 02/14] libstdc++: Optimize std::is_integral compilation performance Ken Matsui
2024-01-10 21:19   ` Jonathan Wakely
2024-01-10  9:22 ` [PATCH 03/14] c++: Implement __is_floating_point built-in trait Ken Matsui
2024-01-17  0:36   ` Jason Merrill
2024-01-10  9:22 ` [PATCH 04/14] libstdc++: Optimize std::is_floating_point compilation performance Ken Matsui
2024-01-10 21:20   ` Jonathan Wakely
2024-01-10  9:22 ` [PATCH 05/14] c++: Implement __is_arithmetic built-in trait Ken Matsui
2024-01-10  9:22 ` [PATCH 06/14] libstdc++: Optimize std::is_arithmetic compilation performance Ken Matsui
2024-01-10 21:20   ` Jonathan Wakely
2024-01-10  9:22 ` [PATCH 07/14] libstdc++: Optimize std::is_fundamental " Ken Matsui
2024-01-10  9:22 ` [PATCH 08/14] libstdc++: Optimize std::is_compound " Ken Matsui
2024-01-10 21:21   ` Jonathan Wakely
2024-01-11  3:02     ` Ken Matsui
2024-01-11  4:14       ` [committed] " Ken Matsui
2024-01-10  9:23 ` [PATCH 09/14] c++: Implement __is_unsigned built-in trait Ken Matsui
2024-01-17  0:41   ` Jason Merrill
2024-01-10  9:23 ` [PATCH 10/14] libstdc++: Optimize std::is_unsigned compilation performance Ken Matsui
2024-01-10 21:22   ` Jonathan Wakely
2024-01-10  9:23 ` [PATCH 11/14] c++: Implement __is_signed built-in trait Ken Matsui
2024-01-10  9:23 ` [PATCH 12/14] libstdc++: Optimize std::is_signed compilation performance Ken Matsui
2024-01-10 21:22   ` Jonathan Wakely
2024-01-10  9:23 ` [PATCH 13/14] c++: Implement __is_scalar built-in trait Ken Matsui
2024-01-10 19:59   ` Ken Matsui
2024-01-10  9:23 ` [PATCH 14/14] libstdc++: Optimize std::is_scalar compilation performance Ken Matsui
2024-01-10 21:22   ` Jonathan Wakely

Reply instructions:

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

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

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d57bc8d-ab34-eee0-79d2-ee5d13322079@redhat.com \
    --to=josmyers@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=jwakely.gcc@gmail.com \
    --cc=jwakely@redhat.com \
    --cc=kmatsui@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).