delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/02/04/03:26:30

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4989511F.4040200@cwilson.fastmail.fm>
Date: Wed, 04 Feb 2009 03:26:07 -0500
From: Charles Wilson <cygwin AT cwilson DOT fastmail DOT fm>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: "Incompatible" typedefs
References: <1233680809 DOT 17414 DOT 1298297091 AT webmail DOT messagingengine DOT com> <20090203171556 DOT GB12192 AT ednor DOT casa DOT cgf DOT cx>
In-Reply-To: <20090203171556.GB12192@ednor.casa.cgf.cx>
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

Christopher Faylor wrote:
> On Tue, Feb 03, 2009 at 12:06:49PM -0500, Charles Wilson wrote:
>> I ran across an oddity in the cygwin headers today.
> 
> This boils down to "What does linux do?".  If we are doing something
> different then PTC.

Errr, it's a little weird. On linux, I have:

From <sys/types.h>
typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));

From <stdint.h>
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;

From <bits/types.h>
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;

So it looks like everything is defined in terms of ANSI C types (int,
char, etc) without the intermediation that cygwin's headers use. So, all
of the [__]u[_]int32_t types are all 'unsigned int'.

I'm guessing that "__attribute__ ((__mode__ (__SI__)))" doesn't make
u_int32_t different than uint32_t.  But apparently there is some heavy
duty compiler magic happening, because I would have thought that these two:

typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned short int uint16_t;

are very different. But they are not (in that a variation of my test
case I posted earlier, emits no warnings with these two types).

I'm not sure what useful conclusions we can draw from looking at how
linux does it, Or maybe I just need some sleep.

--
Chuck

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

- Raw text -


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