delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/12/14:18:19

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SARE_SUB_ENC_UTF8x2,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Eric Blake <ebb9 AT byu DOT net>
Subject: Re: Supporting Data Types =?utf-8?b?InVzaG9ydF90Ig==?= and =?utf-8?b?InVjaGFyX3Qi?=
Date: Wed, 12 Aug 2009 18:17:50 +0000 (UTC)
Lines: 30
Message-ID: <loom.20090812T181513-87@post.gmane.org>
References: <4A82CBB1 DOT 30507 AT comcast DOT net> <20090812141530 DOT GA14016 AT calimero DOT vinschen DOT de> <4A82CF78 DOT 4050504 AT comcast DOT net> <f60fe000908120726w5b1770efub8b6f17e01ec1f3f AT mail DOT gmail DOT com> <4A82D5CD DOT 1020604 AT comcast DOT net> <4A82DA42 DOT 3030805 AT gmail DOT com>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
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

Dave Korn <dave.korn.cygwin <at> googlemail.com> writes:

> Declaring a typedef
> that is exactly the same as a builtin type (as opposed to one that has 
different
> semantics, even though it is defined in terms of the internal types) is fairly
> silly.  "unsigned char" is every bit as hardware agnostic as "uchar_t", it's
> pointless.

Not _entirely_ pointless.  There are some things that you can do with one-word 
typedefs that you can't do with multi-token primitive types, such as this gem 
from gnulib's test-alignof.c:

typedef long double longdouble;

#define CHECK(type) \
  typedef struct { char slot1; type slot2; } type##_helper; \
  verify (alignof_slot (type) == offsetof (type##_helper, slot2)); \
  const int type##_slot_alignment = alignof_slot (type); \
  const int type##_type_alignment = alignof_type (type);

>   I would suggest you guys just avoid the use of these misbegotten aliases in
> your code...

This statement is still true - portable code should not rely on an unspecified 
typedef.

-- 
Eric Blake



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