delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/13/12:23:41

Date: Thu, 13 May 1999 19:21:07 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Pasi Franti <franti AT cs DOT joensuu DOT fi>
cc: djgpp AT delorie DOT com, ageenko AT cs DOT joensuu DOT fi
Subject: Re: Portability and size_t type related question
In-Reply-To: <Pine.SOL.4.10.9905131626430.17043-100000@cs.joensuu.fi>
Message-ID: <Pine.SUN.3.91.990513191920.26392A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 13 May 1999, Pasi Franti wrote:

> #include <limits.h>
> #if (INT_MAX == 2147483647)
> typedef int int32;
> #elif (LONG_MAX == 2147483647)
> typedef long int32;
> #elif (SHRT_MAX == 2147483647)
> typedef short int32;
> #else
> #error "No 32-bit type!"
> #endif

This is not very reliable.  For example, if int is 16 bit, the first #if 
might give you a false hit due to overflow.

- Raw text -


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