Re: "Portability" contructs like UINT32 etc.
- From: Eric Sosman <eric.sosman@xxxxxxx>
- Date: Fri, 07 Oct 2005 09:53:33 -0400
John Devereux wrote On 10/07/05 05:40,:
>
> Perhaps I was not clear; the typedefs go in a single "portability"
> header file and are specific to the machine. E.g.
>
> #ifdef __X86
> typedef short int INT16;
> ...
> #endif
> #ifdef __AVR
> typedef int INT16;
> ...
> #endif
>
> (made up examples)
>
> It should be understood that this file will need to be changed for
> each new machine, but that hopefully nothing else will. By using
> UINT32 etc thoughout, nothing needs to change except this one file.
IMHO it's preferable to base such tests on the actual
characteristics of the implementation and not on the name
of one of its constituent parts:
#include <limits.h>
#if INT_MAX == 32767
typedef int INT16;
#elif SHRT_MAX == 32767
typedef short INT16;
#else
#error "DeathStation 2000 not supported"
#endif
This inflicts <limits.h> on every module that includes
the portability header, but that seems a benign side-
effect.
--
Eric.Sosman@xxxxxxx
.
- Follow-Ups:
- Re: "Portability" contructs like UINT32 etc.
- From: Walter Roberson
- Re: "Portability" contructs like UINT32 etc.
- From: John Devereux
- Re: "Portability" contructs like UINT32 etc.
- References:
- On what does size of data types depend?
- From: Sunil
- "Portability" contructs like UINT32 etc.
- From: John Devereux
- Re: "Portability" contructs like UINT32 etc.
- From: Jack Klein
- On what does size of data types depend?
- Prev by Date: Re: Simulation of Sizeof operator
- Next by Date: Re: [OT] Re: First computer
- Previous by thread: Re: "Portability" contructs like UINT32 etc.
- Next by thread: Re: "Portability" contructs like UINT32 etc.
- Index(es):
Relevant Pages
|