WITH statement

zben at umd5.umd.edu.UUCP zben at umd5.umd.edu.UUCP
Thu Jul 17 12:25:39 AEST 1986


In article <2366 at umcp-cs.UUCP> chris at maryland.UUCP (Chris Torek) writes:
> (I have a feeling that `WITH' originally meant `Listen, compiler,
> put a pointer to this here record into a machine register now,
> because I am about to use it a whole bunch.')

And well it might, if the subject record be selected from a record array.
The Pascal compiler on the SperrySaur has a limit of something like five
of these "nontrivial WITHs" to be open at any one time.

The idea was to avoid repeating the same selector expression over and over
again, and is akin to the C syntax:

       maskarray[selector] |= xbit;     /* Set X bit in maskarray */

The ambiguous condition scares me too, and I think I could live much better
with being able to take the address of the thing and then using it, like:

       recpointer := &recarray[selector];
       ...
       recpointer^.foo := 1;
       recpointer^.bar := 2;

While the & operator (find address) is highly non-standard Pascal, you can
do much the same thing in legal C right now.  Why mess with the language?

Not only has UMD5 arisen as a MicroVax from its previous incarnation as an 
11/44, but I am using a Macintosh Plus and MacKermit to type this in.
Are we having fun yet?

-- 
                    umd5.UUCP    <= {seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben
Ben Cranston zben @ umd2.UMD.EDU    Kingdom of Merryland Sperrows 1100/92
                    umd2.BITNET     "via HASP with RSCS"



More information about the Comp.lang.c mailing list