mP 602 release

Discuss about beta versions of mikroPascal compiler.
Post Reply
Author
Message
janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

mP 602 release

#1 Post by janni » 24 Oct 2006 14:45

Hey, the for... to loop does everything I, more or less humbly :wink: , asked for (and still keeping what other people wanted!).

To be honest, I have to report that it does have a tiny flow, but probably nobody will stumble on it, so I won't tell more. (Otherwise you guys would fix it and I certainly do not want that :twisted: .)

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: mP 602 release

#2 Post by zristic » 24 Oct 2006 15:17

Please, let us know of the problem. It will be found in mB too otherwise. mikroBasic users are almighty, they find everything. Furthermore, let us fix the problem forever.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#3 Post by janni » 24 Oct 2006 17:14

Should have kept my mouth shut.

Still, I do not think it's a real problem and it should be enough to mention it in help, so please, please leave it as it is.

OK, I'm digging my own grave but here it goes. Such a loop will run forever:

Code: Select all

var i:byte;

 for i:=250 to 255 do
  begin
   if i=255 then continue;
  end;
Note that it does not make sense at first look to use such a construct (so probably nobody will), but if you use something like this:

Code: Select all

 k:=50;
 for i:=0 to k do
  begin
   if 'logical expression' then break;
   if i=k then continue;
  end;
then you may check if and when execution of the loop was discontinued by checking the counter. Normal execution will end with i=k+1. Abnormal, caused by break command will give i=0..k.

If I may suggest, place this code in help as an educational example (which will make the behaviour intentional :) ). Then place a warning that trying to countinue the loop above counter's range results in infinite loop and nobody would even have a right to complain.

BTW the help still contains the statement:
The for statement results in an endless loop if the final_value equals or exceeds the range of counter’s type.

Post Reply

Return to “mikroPascal Beta testing”