Re: advantage of using typedefs
- From: Emmanuel Delahaye <emdel@xxxxxxxxxxxxxx>
- Date: Sat, 28 Jan 2006 09:14:33 +0100
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.
-- A+
Emmanuel Delahaye .
- Follow-Ups:
- Re: advantage of using typedefs
- From: junky_fellow@xxxxxxxxxxx
- Re: advantage of using typedefs
- References:
- advantage of using typedefs
- From: junky_fellow@xxxxxxxxxxx
- advantage of using typedefs
- Prev by Date: More Solutions
- Next by Date: Re: Bit-fields and integral promotion/UACs
- Previous by thread: advantage of using typedefs
- Next by thread: Re: advantage of using typedefs
- Index(es):
Relevant Pages
|