Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!unmvax!uokmax!d.cs.okstate.edu!minich From: minich@d.cs.okstate.edu (Robert Minich) Newsgroups: comp.sys.mac.programmer Subject: Re: THINK C Suggestions Message-ID: <1990Oct10.054054.25762@d.cs.okstate.edu> Date: 10 Oct 90 05:40:54 GMT References: <1990Oct9.171921.29529@mtcchi.uucp> Organization: Oklahoma State University Lines: 44 palmer@nntp-server.caltech.edu (David Palmer) writes: Here's a suggestion for the next 'Think C'. Allow the operator '->>' to dereference handles, just as '->' dereferences pointers. by fjo@mtcchi.uucp (2667-Frank Owen(ZG90210)0000): | You should be able to use standard C syntax just as easily for this. | If 'p' is a pointer to a structure that has a member 'x', then | 'p->x' references the member. If 'h' is a handle to the structure, | then '(*h)->x' references the member. | | What's so hard about this? I'd rather stick with standard syntax whenever | possible. Your argument (except for supporting a standard) is completely bunk. If nothing is so hard about (*p)->x then why not (*p).x instead of p->x ??? What's so hard about THIS? Personally, I tend to end up with a ton a parenthesis and adding a couple more often makes it harder to understand but that's C for you. Make's me want to go back to Pascal at times (no often, though) (*object_ptr)->object_field (*((Handle *)(&(myPtr))))->field is equivalent to object_ptr^^.object_field Handle(@myPtr)^^field Of course the second part is rather dumb, but it demonstates the point. Now add a couple more typecasts in there and try your luck at figuring out you forgot a dereference and the C compiler didn't mind a bit. :-) -- |_ /| | Robert Minich | |\'o.O' | Oklahoma State University| A fanatic is one who sticks to |=(___)= | minich@d.cs.okstate.edu | his guns -- whether they are | U | - Ackphtth | loaded or not.