[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Gm2] Re: A limitation in gm2 ?
From: |
Breeden, Thomas (tmb) |
Subject: |
RE: [Gm2] Re: A limitation in gm2 ? |
Date: |
Thu, 6 May 2010 17:29:33 -0400 |
Note that the ISO standard definitely rules out REAL as the index of a FOR loop:
"The type of the control variable shall be an ordinal type that is
assignment-compatible with the type
of the initial value."
And I can't imagine any Wirth compiler accepting this usage - I would think
allowing it would just make the compiler bigger without any chance of improving
the generated code over that of what a WHILE loop would give you.
Is there any reason not to use just a WHILE loop here?
Tom
address@hidden
> -----Original Message-----
> From: address@hidden [mailto:gm2-
> address@hidden On Behalf Of Gaius Mulley
> Sent: May 06, 2010 12:40 PM
> To: Steve Giess
> Cc: address@hidden
> Subject: [Gm2] Re: A limitation in gm2 ?
>
> Steve Giess <address@hidden> writes:
>
> > Dear Gaius,
> >
> > I tried using a floating point variable in a FOR loop. This raised a tree
> > parsing error.
> >
> > r : REAL;
> > ....
> >
> > FOR r:= 0.0 TO 7.0 DO
> > ...
> >
> > END;
> >
> > The only copy I have access to of the Modula-2 definition implies that this
> > should be legal (albeit with step sizes limited to whole numbers). Is it a
> > limitation on your gm2 implementation?
>
> Hi Steve,
>
> ahh yes - I thought for loops only allowed ordinal valued expressions.
> Upon reading the standard it does not rule floating point values out
> of for loops - I'll fix this!
>
> > Yes, I know FP loops are not the best, but otherwise having to scatter VAL
> > (REAL, integer_loop_variable) expressions in complex REAL mathematical
> > expressions makes for hard-to-read code.
>
> indeed..! Will fix..
>
> regards,
> Gaius
>
>
> _______________________________________________
> gm2 mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/gm2