Re: advantage of using typedefs
- From: "junky_fellow@xxxxxxxxxxx" <junky_fellow@xxxxxxxxxxx>
- Date: 28 Jan 2006 00:50:55 -0800
Emmanuel Delahaye wrote:
> junky_fellow@xxxxxxxxxxx a écrit :
> > I wanted to know what advantage do we get by typedefs ? Why we did not
> > declare
> > offset simply as
> > long off_t;
>
> It's often a portability issue. Imagine you want a type that hold the
> biggest possible unsigned integer.
>
> You will have this in C90:
>
> typedef unsigned long biggest_int_t;
>
> and that on C99:
>
> typedef unsigned long long biggest_int_t;
>
> With the help of some smart macros and #ifxxx directives, After a simple
> recompile, the type will automagically be corrected after a simple
> recompile of the project/lib or whatever.
>
Thanx for your reply, Emmanuel. But if this is the case (ie we need
the biggest possible
unsigned integer to hold offset ) then why not declare
unsigned long long offset;
I believe unsigned long long should be highest possible integer type ?
Or am I wrong ?
Is there any other reason for doing that ?
.
- Follow-Ups:
- Re: advantage of using typedefs
- From: Thad Smith
- Re: advantage of using typedefs
- From: Mark McIntyre
- Re: advantage of using typedefs
- References:
- advantage of using typedefs
- From: junky_fellow@xxxxxxxxxxx
- Re: advantage of using typedefs
- From: Emmanuel Delahaye
- advantage of using typedefs
- Prev by Date: Re: More Solutions
- Next by Date: Re: More Solutions
- Previous by thread: Re: advantage of using typedefs
- Next by thread: Re: advantage of using typedefs
- Index(es):
Relevant Pages
|