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 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: References: <4A82CBB1 DOT 30507 AT comcast DOT net> <20090812141530 DOT GA14016 AT calimero DOT vinschen DOT de> <4A82CF78 DOT 4050504 AT comcast DOT net> <4A82D5CD DOT 1020604 AT comcast DOT net> <4A82DA42 DOT 3030805 AT gmail DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: List-Subscribe: List-Archive: List-Post: List-Help: , 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 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