"Portability" contructs like UINT32 etc.
- From: John Devereux <jdREMOVE@xxxxxxxxxxxxxxxxxx>
- Date: 05 Oct 2005 14:14:03 +0100
"Sunil" <sunil.goutham@xxxxxxxxx> writes:
> Hi all,
>
> I am using gcc compiler in linux.I compiled a small program
> int main()
> {
> printf("char : %d\n",sizeof(char));
> printf("unsigned char : %d\n",sizeof(unsigned char));
> printf("short : %d\n",sizeof(short));
<SNIP>
This brings to mind something that I have wondered about.
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.
What do people here think is best?
--
John Devereux
.
- Follow-Ups:
- Re: "Portability" contructs like UINT32 etc.
- From: Jack Klein
- Re: "Portability" contructs like UINT32 etc.
- From: Christian Bau
- Re: "Portability" contructs like UINT32 etc.
- From: Keith Thompson
- Re: "Portability" contructs like UINT32 etc.
- From: tanmoy87544
- Re: "Portability" contructs like UINT32 etc.
- From: Lowell Gilbert
- Re: "Portability" contructs like UINT32 etc.
- References:
- On what does size of data types depend?
- From: Sunil
- On what does size of data types depend?
- Prev by Date: Re: Image BMP
- Next by Date: Re: Modularisation
- Previous by thread: Re: On what does size of data types depend?
- Next by thread: Re: "Portability" contructs like UINT32 etc.
- Index(es):
Relevant Pages
|