Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!exodus!prisoner.Eng.Sun.COM!zellers From: zellers@prisoner.Eng.Sun.COM (Steve Zellers) Newsgroups: comp.sys.mac.programmer Subject: Re: THINK C Suggestions Message-ID: <1314@exodus.Eng.Sun.COM> Date: 11 Oct 90 22:04:44 GMT References: <90283.224058CXT105@psuvm.psu.edu> Sender: news@exodus.Eng.Sun.COM Organization: Sun Microsystems, Mt. View, Ca. Lines: 51 In article <90283.224058CXT105@psuvm.psu.edu> CXT105@psuvm.psu.edu (Christopher Tate) writes: >Personally, I find this one of the most glaring omissions in C. It's >pretty icky to have to type 17 lines of "(**myHandle).whatever = something;" >instead of a nice pretty "WITH myHandle^^ do begin....end." And, since >it's a bracketed construct, C has an easy time figuring out when to do >the dereferencing. C doesn't have this, because C requires the programmer to do most of his optimizations... (You can't move memory from within a with mumble^^ either) Consider: { (**(**onehandle).somethingotherhandle).mumblefrotz[0] = 42; (**(**onehandle).somethingotherhandle).mumblefrotz[1] = 18; } Well, if you REALLY NEED a with, then: { #define WITH (**(**onehandle).somethingotherhandle) WITH.mumblefrotz[0] = 42; WITH.mumblefrotz[1] = 18; #undef WITH } But you're programming in C for a reason, right? { reg mumbleptr pmum = (**(**onehandle).somethingotherhandle).mumblefrotz; *pmum++ = 42; *pmum = 18; } This will generate better code than THINK or MPW pascal by the way. If you like things 'automagic' and hidden from you, by all means, keep using pascal. It's not C's purpose. I've seen/written a lot of pascal that used WITH's, but it really doesn't help much, accept in the simplest cases. (My boss used to bitch me out for assigning temporary pointers in my pascal code - but how else are you supposed to compare disparate elements of some heavily dereferenced structure? You can't 'with' them both...) Ooops, I'm raving. Nevermind. >Maybe we should move this discussion to comp.lang.c, where it belongs.... They might laugh. -- ------------------------------------------------------------------------ Steve Zellers zellers@prisoner.sun.com "All you slimy fruitcakes in San Fransisco are going to find out how to get to 180 and the letter 'G'. I repeat, there is No Other Possibility."