Mark Nudelman wrote:

> Aaron Ardiri wrote:
> > typedef struct
> > {
> >   int a;
> > } MyStruct, *MyStructPtr;
>
> At the risk of starting a religious war, I have to ask: why do people
> (including the writers of the Palm header files) create typedefs for
> pointers?  I find it simpler, cleaner and easier to read if I just say
>         MyStruct *p;
> rather than
>         MyStructPtr p;

That was in fact brought up at the development track at PalmSource last
week.  According to David Fedor -- Dave, please correct me on this if I'm
wrong -- but the *FooPtr typedefing is in fact being phased out of future
releases of the API.  I don't know if this all can be done in 3.5 or not.

The legacy I have been told is that this was done for early C compilers
that needed to calculate a pointer table for all pointers explicitly
declared in non-inlined code.  If a typedef to a pointer was already
defined, then it let the compiler to skip an address calculation in the
pointer table as object code was bring generated.  I don't know how much of
an issue this is now.

Steve

Reply via email to