delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/05/24/21:31:52

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:references:to:subject
:content-type; q=dns; s=default; b=eYmAG3/Djc6yvqettw1Slo1hdrCWd
UJNK3NPqwKDkS5UWNfMT6VmXhib0OGQVaB3ynnBSGKZmUcD+dnER58yq8Qd+SiE0
9IbK+cRU9sQzeIQeezqyqilAGvEeq45TpOHeFFsghJ3Y6sRokB4aalC3nWJLoM5t
xx/mBN+NaongIQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:references:to:subject
:content-type; s=default; bh=Z87LamqgidkZDAsXPb+CT6ChREE=; b=MbW
FErp0KuroK95VZxEylhimd7x+dGABUwbqsMx5FD+CnaNxwaYAGD8oOo9CArkRkd+
jkqvv+vs/sxV+Wlp+5ZxeH8KFS995YfALDsTg7IxMk06Tgw7/+fBpKOOfMTGN16D
+Roi2/qBwKAoMR6FuohuN8g1wNimKJR3wdagejrY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:633, H*M:google
X-HELO: mail-oi0-f48.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:references:to:subject :user-agent; bh=gVbLZsAYNtwEBtNHOo9vG2mxKEpdaEEOahwC6ZkiuzI=; b=ldvu4OhSR/buoQeFpshTGcTnwwc6MEJfkd7YinIgtJZRt0ovPubw4U71d9LCmvXpcW 8Hl00fpUBJMpf+yTRrqC6MQ4XmfigMIjL9KuAyC5lpMa5W4j5T4ZeSAeWBQ2iJ713Luv u8d+YfuIczRxCK/WBxSG1Tkw1Pdew0rLIiIEmzEy+1ZstFK8eTPSXIb8eUPPIm9ONQ6v ocp+ADzuuQRWD9pzLaDzBwjSobPDReB6o9CrDJSYEkOHukHhRO4brrVbi99CBPGTbFHc Wx3AjVgwh5b9RhVVCMiaUh1SmxFZ9v9fullr6ydRaUDoKl8lsLerZDGt9rHkKculM09i jYuQ==
X-Gm-Message-State: AODbwcDeNzQYMxJsN1Vhtaa3Jrpq2BFrRJO7xqrt0Uiw6PJec1kx0Zz6 5lmgL1dLtmZDC5ya
X-Received: by 10.157.41.203 with SMTP id g11mr5647634otd.72.1495675895251; Wed, 24 May 2017 18:31:35 -0700 (PDT)
Message-ID: <592633f6.4436ca0a.dc1a8.58f2@mx.google.com>
Date: Wed, 24 May 2017 18:31:34 -0700 (PDT)
From: Steven Penny <svnpenn AT gmail DOT com>
X-Google-Original-From: Steven Penny
References: <592618e3 DOT 08179d0a DOT 27b5e DOT 4630 AT mx DOT google DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: bug in lrint [was: FW: Printing long int in C program under cygwin64]
User-Agent: Tryst/2.0.1 (github.com/svnpenn/tryst)

On Wed, 24 May 2017 16:36:03, Steven Penny wrote:
> Aren’t both wrong? By definition %i is a signed integer, and size_t is unsigned.
> So %zu or %llu would be more correct:
> 
> http://wikipedia.org/wiki/C_data_types
> 
> They all seem to do the job though:

Correcting myself. Here is why you cannot use %zi:

    $ cat alfa.c
    #define __USE_MINGW_ANSI_STDIO 1
    #include <stdio.h>
    int main() {
      printf("%zi %zu %llu\n", __SIZE_MAX__, __SIZE_MAX__, __SIZE_MAX__);
    }

    $ x86_64-w64-mingw32-gcc -o alfa alfa.c

    $ ./alfa
    -1 18446744073709551615 18446744073709551615


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019