[Oberon] [Component Pascal]

Jörg Straube joerg.straube at iaeth.ch
Sat Feb 16 22:11:29 CET 2013


Hi

Yes it's legal. However the runtime behaviour depends on how clever the compiler is.
The book "Programming in Oberon" says
"The for statement has the advantage of guaranteed termination."
So for example a stupid compiler translates the following code into a program that runs forever:
  FOR i := 1 TO 2 DO DEC(i) END.

A more clever compiler translates
  FOR i := m TO n-1 DO (* some processing *) END;
into
 temp := m;
 WHILE temp < n DO i:= temp; (* some processing *) INC(temp) END;

Jörg


On 16.02.2013, at 14:49, <Aubrey.McIntosh at Alumni.UTexas.Net> wrote:

> Is this legal?
> 
> 		FOR ix := 0 TO 2 DO
> 			INC( ix )
> 		END;
> 
> -- 
> Aubrey McIntosh, Ph.D.
> 211 E. 5th St.
> Morris MN 56267
> (512)-348-7401
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.inf.ethz.ch/pipermail/oberon/attachments/20130216/5c0babe6/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2334 bytes
Desc: not available
Url : https://lists.inf.ethz.ch/pipermail/oberon/attachments/20130216/5c0babe6/attachment.bin 


More information about the Oberon mailing list