Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: What is the rank of size_t ?
Date: Wed, 03 Jun 2020 11:16:08 -0700
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <867dwoow0n.fsf@linuxsc.com>
References: <86pnamrs9r.fsf@linuxsc.com> <86k10rpqum.fsf@linuxsc.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="c2e7fdc8253a62623e6cece72591ee6d"; logging-data="7948"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Zzk2R2gB4bu7BZ1N4JeoCB575Cffq0tQ="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:yOxIOFuzxAQ+PnhbI+50hovD6Uo= sha1:0xbzRiyDtGGNUAlYULwKEWqsdpk=
Xref: csiph.com comp.lang.c:152649
Ike Naar writes:
> On 2020-06-01, Tim Rentsch wrote:
>
>> Well that explains at least some of it. What do you get if
>> you run this:
>>
>> #include
>> #include
>>
>> int
>> main(){
>> printf( "INTMAX_MAX is %td\n", INTMAX_MAX );
>
> Why use %td (which applies to an argument of type ptrdiff_t),
> instead of %jd (which applies to an argument of type intmax_t)?
Because
(1) I don't use either often enough to remember which is
which, and I confused the two;
(2) I didn't bother (even though I usually do, I didn't
this time) to check the Standard to be sure; and
(3) I got a false positive from gcc as a result of
intmax_t and ptrdiff_t having the same underlying
type, so test compiling the program didn't give a
-Wformat diagnostic.