delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/03/28/09:05:44

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:mime-version:to:subject
:references:in-reply-to:content-type; q=dns; s=default; b=JMlTRt
uR1tn47Tq+/hUPU9V13pP53x1fvFTZwWvLdfeaMAF8w+Ev8+DmTLWz2Tf4XgECoz
evvwWuYM2PieIGFyTLSBWqk2VVylLbbpYC1oN/wrw+Q7m1HU9sD7izOViLRaNPuK
l9Pi5kIECnngnvQnSykGeaJhXMFCwOubOJ+zU=
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:mime-version:to:subject
:references:in-reply-to:content-type; s=default; bh=YzEAx7Cji9sP
3Yk2VUqbP+gmojE=; b=YbKy23w7guDzoQ8T+Sq9cbxxLp35oQSVwWj4n/WP9Yk7
4E6U6gQI9Snjv6m1CubTAY2Cqlbzxj91cx25njAw6IFoTHxt7jwmm56G5pkPHelv
gFPEAulLz3RXoKuXAnSj+ObRk7Ul3j0hP+Hq/1gbSd3J1P6Kn+teKHXFyaV8EfU=
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.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mx1.redhat.com
Message-ID: <53357393.60603@redhat.com>
Date: Fri, 28 Mar 2014 07:05:23 -0600
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: open(O_RDWR) and lseek() fail
References: <20140328093110 DOT GA23367 AT calimero DOT vinschen DOT de> <0D835E9B9CD07F40A48423F80D3B5A702CE06F27 AT USA7109MB022 DOT na DOT xerox DOT net>
In-Reply-To: <0D835E9B9CD07F40A48423F80D3B5A702CE06F27@USA7109MB022.na.xerox.net>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
X-IsSubscribed: yes

--iIxxrR5EN42AreIGEHXuDDkdNl3BjHWl7
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 03/28/2014 06:53 AM, Nellis, Kenneth wrote:
> x.c:12:2: warning: format =E2=80=98%d=E2=80=99 expects argument of type =
=E2=80=98int=E2=80=99, but argument 2 has type =E2=80=98off_t=E2=80=99 [-Wf=
ormat=3D]
>=20
> So, then, after changing %d to %lld, gcc -Wall -pedantic complains:

My advice: You usually do NOT want to compile with -pedantic.  That
option exists for programs that are sticking _strictly_ to the C
standard, but lseek() and off_t are not part of the C standard.  There
is no portable way to be pedantic to the C89 standard and simultaneously
use 64-bit offsets.  The situation is better in C99, since that
introduced 64-bit types.

If you want to use %lld, you have to use C99, not C89; use gcc -std=3Dc99
or gcc -std=3Dgnu99.  By omitting -std, you got gcc's default, which for
now is still -std=3Dc89.

> Wondering how to printf an off_t value without the compiler complaining w=
hile
> using -Wall -pedantic.

You can't.  So drop the -pedantic.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--iIxxrR5EN42AreIGEHXuDDkdNl3BjHWl7
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJTNXOTAAoJEKeha0olJ0NqOfoH+gIz9vBk2AvGThq0sbrWHIXZ
AdC3dOp9igitqPd+8wBW+IGUqmPH4CqKueIeQ83p+maYKU5wnAISrTTsF8SVrRVq
6VbNccyjOdyth1Rhq8KkvF1rR7x2KKvDssiLwUCvYQJaa2n/UfzSQAR3N6XF46/f
zwxOWYQKs60VF3qpJJRsvNVo+f67WQc44xto7kqmNnTpFh1uKDFSyHrP9sDPL8kp
07V/JRH1N4Yy7U0j16Y+UAJcZYH1slI7y4zyshNfPgQDVduIABC17asv0dVPITi3
4py+KKrLEnGVzKOuTtn7cZ5bJLA96ZBVQ64kE04lJlaZfogZKpZ6wvFx4EGWLbg=
=KBM2
-----END PGP SIGNATURE-----

--iIxxrR5EN42AreIGEHXuDDkdNl3BjHWl7--

- Raw text -


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