Re: advantage of using typedefs



On 2006-01-28, junky_fellow@xxxxxxxxxxx <junky_fellow@xxxxxxxxxxx> wrote:
> I was looking at the source code of linux or open BSD. What I found
> that lots of typedefs
> were used. For example, consider the offset in a file. It was declared
> as
> off_t offset;
> and off_t is typedefed as
> typedef long off_t;

On your system. On my system it's long long.

>
> I wanted to know what advantage do we get by typedefs ? Why we did not
> declare
> offset simply as
> long off_t;
>
> Similar is the case with size of file and so on.....
>
> Does any one has any clue of why do we use typedefs in such cases ?
>
> Thanx for any help advance ....
>
.



Relevant Pages

  • advantage of using typedefs
    ... I was looking at the source code of linux or open BSD. ... consider the offset in a file. ... I wanted to know what advantage do we get by typedefs? ...
    (comp.lang.c)
  • Re: Forward declaration and typedefs
    ... > For some time I've been using typedefs for STL containers for reasons ... > forward declare it: ... > In general it's not recommended to inherit from STL containers because ... header in your header, and you've successfully typedef'd it there, ...
    (comp.lang.cpp)
  • Re: Can one class have two names?
    ... "Gianni Mariani" wrote in message ... > JustSomeGuy wrote: ... > One thing he left out was typedefs. ... While you can declare x in a forward declaration as a class, ...
    (comp.lang.cpp)
  • Re: Strange XCode Linking Error (multiple definitions)
    ... There are two disadvantages to using typedefs. ... Secondly, you can't forward declare a typedef type, whereas ... Usually I see "typedef struct" ... I'd try to limit it to class scope. ...
    (comp.sys.mac.programmer.help)
  • LPCTSTR or PCTSTR which one should we use?
    ... LPTSTR or PTSTR. ... what is the difference between these defined typedefs? ... Prev by Date: ...
    (microsoft.public.vc.language)