|
|
|
|
- Reason
- Tip
- Examples
- 1. Using the LOOP statement without a BREAK statement
- 2. Using the WHILE statement without condition and without BREAK statement
- 3. Loop used to get information about a serial port
Warning 18: Loop without potential end
A LOOP or WHILE statement is used in the current code. No statement is used in this code to force the exit from the loop: a deadlock may occur. Check whether your loop is not an endless loop and whether it is possible to force the exit from the statement block (by using the BREAK statement for example). 1. Using the LOOP statement without a BREAK statement Code triggering the warning LOOP // read a line in the text file ALine = fReadLine(FileNum) ProcessLine(ALine) END
Possible correction Add a line used to process the exit from the loop (in this example, code used to find out whether the end of the file was reached). LOOP // read a line in the text file ALine = fReadLine(FileNum) IF ALine = EOT THEN BREAK ProcessLine(ALine) END
2. Using the WHILE statement without condition and without BREAK statement Code triggering the warning WHILE ALine<>EOT // read a line in the text file ALine = fReadLine(FileNum) ProcessLine(ALine) END
Possible correction Add a line used to process the exit from the loop (in this example, code used to find out whether the end of the file was reached). WHILE ALine<>EOT // read a line in the text file ALine = fReadLine(FileNum) IF ALine = EOT THEN BREAK ProcessLine(ALine) END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|