> > 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;
> In the latter case, it's not as clear that the thing you're defining is
> a pointer; the type name is longer and not as transparently related to
> the base type MyStruct; and there are twice as many typedefs floating
> around.  I can understand doing something like this if you're defining
> an opaque type that isn't meant to be dereferenced (or, heaven forbid,
> you're working on some horrible segmented architecture where you've got
> to distinguish between near/far pointers), but I've seen people do this
> for ordinary pointers that are meant to be dereferenced.  Why?

  i agree with you totally.. the reason why i wrote the code like
  that is because that is how Palm does it - in order to make most
  people "see" what i meant, i stuck to their style.

  inside all my code, if i use a pointer.. then i use the traditional
  style of "* struct".. that way i know that i am dealing with a pointer
  by seeing a "*".. :> i agree with yout point totally.

  in addition.. i hate the "->" syntax.

     event->eType    to me is better written as:
     (*event).eType

  i teach C at the university.. and you would not believe the
  confusion of using ->, they understand (*event), as it works 
  the same for primitive types and structures..

    &var   -> the address of
    *var   -> whats at the address of

  simple case.. :> works perfectly.. of course i tell them that
  "->" can be used too.. 

  religious war? hehe.. well.. you DONT have to use the typedefs :> 
  but... you should try and keep your code looking "similar" in
  style to the base system - which is 3Com's code.

  cheers.

az.
--
Aaron Ardiri 
Lecturer                       http://www.hig.se/~ardiri/
University-College i G�vle     mailto:[EMAIL PROTECTED]
SE 801 76 G�vle SWEDEN       
Tel: +46 26 64 87 38           Fax: +46 26 64 87 88
Mob: +46 70 656 1143           A/H: +46 26 10 16 11

Reply via email to