delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/04/07/04:47:37

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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=oHqnwqyDbhjGH+A71XF9XGE4UCPLwhg9KZq9jn/jgpECaNzjRoxer
3W58a72VS3aEQo8e7SrcaLyHPtMHA3pzf5JvO8ckPB9bmkmjgKPkTOA5pKuvbuNr
C9JCJkvXZn9tUH4hsF4P1BoupjwzN9V55MrBzoPZ/+wof4lll+G5A8=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=BZ/WHudJJp8/izLRlf8o+cORV0w=; b=JGjYVGkO+VpDJP7/yolsc2qRdUxj
Ab+faz3g4njQRDUVdF5nyuPp4IW7mgWK7kL97HH70f/2Uj9qtcOT12R9IV5h1zTP
uDHdToRUbCHMb2EtIIw/KIszX4zd38jWuAucGoyMzWjOz2IAm/I/pwft4Bk3hEGI
6t7a0MtYTGMwnSI=
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=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Mon, 7 Apr 2014 10:47:20 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: long_int vs int byte sizes
Message-ID: <20140407084720.GC2061@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CABKp57PdLMKqmGFhfMEN4BLPFcndkpibora5yx2Xdy6zh4+WzA AT mail DOT gmail DOT com> <6BA0E670DE2A4416BB5A12250B427E5A AT OwnerPC311012>
MIME-Version: 1.0
In-Reply-To: <6BA0E670DE2A4416BB5A12250B427E5A@OwnerPC311012>
User-Agent: Mutt/1.5.21 (2010-09-15)

--nmemrqcdn5VTmUEE
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Apr  6 16:35, sisyphus1 AT optusnet DOT com DOT au wrote:
> -----Original Message----- From: Joseph Maxwell
>=20
> >[quote]
> >int x =3D 0xAB78 in decimal format is : 43896
> >and
> >unsigned int y =3D 0xAB78 in decimal format is : 43896
> >The  size of int is 4 bytes
> >[/quote]
> >
> >Not quite what I expected, sine the leftmost bit in 'int' is 1 and
> >would be the negative flag.
>=20
> No - the full 32-bit representation of 0xAB78 is:
>=20
> 0000 0000 0000 0000 1010 1011 0111 1000
>=20
> The leftmost bit is zero.
>=20
>=20
> >Note size of int and long int are the same both are 4 bytes long
> >
> >Is this to be expected?
>=20
> I think so. I've not yet struck a case on Windows where either int
> or long are not 4 bytes. (Haven't tried Cygwin64.)

On x86_64 Cygwin, sizeof (long) =3D=3D 8.  See
http://cygwin.com/faq/faq.html#faq.programming.64bitporting

> Certainly, on some other systems, int is 4 bytes and long is 8 bytes.
> The standards permit both configurations.

There's no standard which restricts the sizes of the datatypes in
that way.  There's only this rule to follow:

  sizeof (char) <=3D sizeof (short) <=3D sizeof (int) <=3D sizeof (long)


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--nmemrqcdn5VTmUEE
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJTQmYYAAoJEPU2Bp2uRE+glL8P/AqfQjpiVBQFNK/RoYROy6IW
XHtSMvdQYuxiUTeBMcbUl86HafoB5G4PwlNcbb23jqrErGwyZ2O2tk3dexM1SK47
p45WyP2YK8dnJQwzVakJSNdShKDsdEib6Tj34s2vAepnSOYUSJ6/5GHy9yBK/xa5
aHt6no8YBWYTO6/OUh9pjWxSzo9ijfG7lXeE3M/ShEk0gcQkFgKvWSytD+UbrTsC
ytSIXqGRCDO8uGTJKVMKXLOdjnazkKoOlk7Ksqa6qnPNwx3p873u60zuRVCirjgp
IlZ+VIpstKbzIkIMowFy/q5JUrUC4YxNkyslhSQ/GY5+CpoKydExOjVRvsWTv2hk
gAKfTN3ldo9u+T5IjMdfCUUCBkYhT+o/CRSzvH4j2fAN70Vv2ZXsoFkQHZWLX2N/
SCZgb4gNMYFybLu6teWgutE3E3L+StvW4P3PaJK8y3rZocz35os8SFyDfr3mPtdz
YhTlnri/B1jfIdlwBdKr7Ger2gsFNeCh8XJXccJjjO9lL1I0O2Bu6OA6HDLyEj1q
H9W+ewI6A1Xrk7gVqxC9+upUzd+uXNntMmgzu/2LAB8fzwhB9Saj4JKJm1ZUbqjP
Ldtgnu8uRgSSfiZwMfiV0Wm6mZ07/XttUD0B4KHKWjZnziqDsuteWq9gRNJuYQ/C
5a11kWzEOprueWSmETMj
=eS4Z
-----END PGP SIGNATURE-----

--nmemrqcdn5VTmUEE--

- Raw text -


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