delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/04/06/02:36:46

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:from:to:references:in-reply-to
:subject:date:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=O9a9nliTn4VpW4xT
fbR8elaa5Sfzh1IidPuPkCg0LfUXMN4iMlBt3ydByXeHSEJXVceEOn00kkP+WA1S
8Jh/2iJQwN2jXuVKrvm9ncbPdELf7/odoeoloqXHI9oLDbs2gJXmycLVyCOSIIX0
ciIn/r9DVldyjtPFlJMKzUXB8C4=
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:from:to:references:in-reply-to
:subject:date:mime-version:content-type
:content-transfer-encoding; s=default; bh=E8nj8ZUWONWUQyHyuY5eR8
QFpYk=; b=y0tE9Uw97yUfvXbV6zy1zQbkrOgzr+FYxmwjVBYDdvZn418wHYbHL3
Hf9kf9n69DWClhqgie1g7eZop9b+HrbDPXhKlaN59G5Xn7categ/PzPJvW7Sz/lU
FGJ3pj/KitpuHeS68IxUzEqju0EuAhpT46Ij8yL1jPFTg7tZXIZGQ=
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=-0.2 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail110.syd.optusnet.com.au
Message-ID: <6BA0E670DE2A4416BB5A12250B427E5A@OwnerPC311012>
From: <sisyphus1 AT optusnet DOT com DOT au>
To: "Joseph Maxwell" <discard36 AT gmail DOT com>, <cygwin AT cygwin DOT com>
References: <CABKp57PdLMKqmGFhfMEN4BLPFcndkpibora5yx2Xdy6zh4+WzA AT mail DOT gmail DOT com>
In-Reply-To: <CABKp57PdLMKqmGFhfMEN4BLPFcndkpibora5yx2Xdy6zh4+WzA@mail.gmail.com>
Subject: Re: long_int vs int byte sizes
Date: Sun, 6 Apr 2014 16:35:47 +1000
MIME-Version: 1.0
X-Optus-CM-Score: 0
X-Optus-CM-Analysis: v=2.1 cv=U6SrU4bu c=1 sm=1 tr=0 a=8e8rgZJuizJfF74+JHJpGg==:117 a=8e8rgZJuizJfF74+JHJpGg==:17 a=PO7r1zJSAAAA:8 a=52oLloMokugA:10 a=8nJEP1OIZ-IA:10 a=u8qkCuwD83Q3mJpxJIMA:9 a=wPNLvfGTeEIA:10
X-IsSubscribed: yes

-----Original Message----- 
From: Joseph Maxwell

> [quote]
> int x = 0xAB78 in decimal format is : 43896
> and
> unsigned int y = 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.

No - the full 32-bit representation of 0xAB78 is:

0000 0000 0000 0000 1010 1011 0111 1000

The leftmost bit is zero.


> Note size of int and long int are the same both are 4 bytes long
>
> Is this to be expected?

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.)
Certainly, on some other systems, int is 4 bytes and long is 8 bytes.
The standards permit both configurations.

Cheers,
Rob



--
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