linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Colomar <colomar.6.4.3@gmail.com>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>,
	Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
	linux-man <linux-man@vger.kernel.org>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Subject: Re: [RFC] man7/system_data_types.7: Document [unsigned] __int128
Date: Thu, 1 Oct 2020 15:22:29 +0200	[thread overview]
Message-ID: <9937df9c-f516-eada-682f-a755700231ff@gmail.com> (raw)
In-Reply-To: <20201001125401.GF29000@arm.com>



On 2020-10-01 14:54, Szabolcs Nagy wrote:
> The 10/01/2020 12:14, Alejandro Colomar via Gcc wrote:
>> Here is the rendered intmax_t:
>>
>> intmax_t
>>        Include: <stdint.h>.  Alternatively, <inttypes.h>.
>>
>>        A  signed  integer type capable of representing any value of any
>>        signed integer type supported by the implementation.   According
>>        to  the C language standard, it shall be capable of storing val-
>>        ues in the range [INTMAX_MIN, INTMAX_MAX].
>>
>>        The macro INTMAX_C() expands its argument to an integer constant
>>        of type intmax_t.
>>
>>        The  length  modifier  for  intmax_t  for  the printf(3) and the
>>        scanf(3) families of functions is j; resulting commonly  in  %jd
>>        or %ji for printing intmax_t values.
>>
>>        Bugs:  intmax_t  is not large enough to represent values of type
>>        __int128 in implementations where __int128 is defined  and  long
>>        long is less than 128 bits wide.
> 
> or __int128 is not an integer type.
> 
> integer types are either standard or extended.
> and __int128 is neither because it can be
> larger than intmax_t and stdint.h does not
> provide the necessary macros for it.


Hi Szabolcs,

I know GCC decided to not call it an integer type, and call it instead a 
scalar type, just to conform with the standards, at the same time 
provide a 128 int, and at the same time, not have to change the ABI of 
intmax_t.

But it looks like an integer type,
and in almost any possible way, it acts like an integer type.

I could call '__int128' a signed _scalar_ type in the description, but 
that might confuse those who don't know these details.  Do you think it 
would be better to call it that way, or just keep the integer word? 
(Jonathan, I'd also like to know your thoughts on this, BTW).

However, I would still have that bug documented, because in the end, the 
information programmers need is exactly that, and they don't really care 
if GCC calls it one way or the other just to avoid technical issues with 
the standards, IMO.

Thanks,

Alex


BTW, the updated rendered version is like this right now:

[[
__int128
       [signed] __int128

       A signed integer type of a fixed width of exactly 128 bits.
// This could change to "signed scalar type", but...

       When  using GCC, it is supported only for targets where the com-
       piler is able to generate  efficient  code  for  128-bit  arith-
       metic".

       Versions: GCC 4.6.0 and later.

       Conforming to: This is a non-standard extension, present in GCC.
       It is not standardized by the C language standard nor POSIX.

       Notes: This type is available without including any header.

       Bugs: It is not possible to express an integer constant of  type
       __int128  in  implementations  where  long long is less than 128
       bits wide.

       See also the intmax_t, intN_t and  unsigned  __int128  types  in
       this page.

[...]

unsigned __int128
       An unsigned integer type of a fixed width of exactly 128 bits.
// This could change to "signed scalar type", but...

       According  to  GNU,  it  is supported only for targets where the
       compiler is able to generate efficient code for  128-bit  arith-
       metic".

       Versions: GCC 4.6.0 and later.

       Conforming to: This is a non-standard extension, present in GCC.
       It is not standardized by the C language standard nor POSIX.

       Notes: This type is available without including any header.

       Bugs: It is not possible to express an integer constant of  type
       unsigned __int128 in implementations where unsigned long long is
       less than 128 bits wide.

       See also the __int128, uintmax_t and uintN_t types in this page.
]]

  reply	other threads:[~2020-10-01 13:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  9:24 [RFC] man7/system_data_types.7: Document [unsigned] __int128 Alejandro Colomar
2020-10-01  9:57 ` Jonathan Wakely
2020-10-01 10:14   ` Alejandro Colomar
2020-10-01 10:50     ` Jonathan Wakely
2020-10-01 11:24       ` Alejandro Colomar
2020-10-01 11:46         ` Jonathan Wakely
2020-10-01 12:54     ` Szabolcs Nagy
2020-10-01 13:22       ` Alejandro Colomar [this message]
2020-10-01 13:46         ` Jonathan Wakely
2020-10-01 17:31     ` Joseph Myers
2020-10-02  8:10       ` Alejandro Colomar

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=9937df9c-f516-eada-682f-a755700231ff@gmail.com \
    --to=colomar.6.4.3@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=szabolcs.nagy@arm.com \
    /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 NNTP newsgroup(s).