Pascal vs C, again (was: Pascals Origins)

Ben Cranston zben at umd5.umd.edu
Wed Jul 23 09:20:42 AEST 1986


In article <3142 at utcsri.UUCP> greg at utcsri.UUCP (Gregory Smith) writes:

> As for the lack of break, it is a fact of life that loops do not always
> exit at the same point in the cycle as they start. Pascal ignores this.

Over the last ten years I have implemented several (interpretive) languages
with the extended repeat syntax:

   repeat
      (block 1)
   until condition
      (block 2)
   endrep

The idea was to allow the entry point and exit point of the loop to differ
without breaking the rule that a loop has only one exit point.

   repeat
      fooptr := readnextfoo(foofile)
   until (fooptr=0)
      haveyourwaywithfoo(fooptr)
   endrep

In C one would write:

   while ( 0 != (fooptr = readnextfoo(foofile)) )
      haveyourwaywithfoo(fooptr);

-- 
                    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