Re: "Portability" contructs like UINT32 etc.
- From: Christian Bau <christian.bau@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 05 Oct 2005 23:13:50 +0100
In article <87vf0c9kdg.fsf@xxxxxxxxxxxxxxxxxxxxxxx>,
John Devereux <jdREMOVE@xxxxxxxxxxxxxxxxxx> wrote:
> I often see advice elsewhere, and in other peoples programs,
> suggesting hiding all C "fundamental" types behind typedefs such as
>
> typedef char CHAR;
> typedef int INT32;
> typedef unsigned int UINT32;
> typedef char* PCHAR;
>
> The theory is that application code which always uses these typedefs
> will be more likely to run on multiple systems (provided the typedefs
> are changed of course).
>
> I used to do this. Then I found out that C99 defined things like
> "uint32_t", so I started using these versions instead. But after
> following this group for a while I now find even these ugly and don't
> use them unless unavoidable.
typedef char CHAR; and typedef char* PCHAR; is just plain stupid.
"int", "long" etc. , properly used, is the best way to code. However,
they are often not properly used, and there will be lots of trouble
because of that when 64 bit systems become more widely available. If you
use a typedef like INT32 or uint32_t, at least I know what assumptions
you made.
.
- References:
- On what does size of data types depend?
- From: Sunil
- "Portability" contructs like UINT32 etc.
- From: John Devereux
- On what does size of data types depend?
- Prev by Date: Re: struct initialization
- Next by Date: Re: struct initialization
- Previous by thread: Re: "Portability" contructs like UINT32 etc.
- Next by thread: Re: "Portability" contructs like UINT32 etc.
- Index(es):
Relevant Pages
|