PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • 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
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Warning 18: Loop without potential end
Reason
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.
Tip
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).
Examples

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
WINDEVWEBDEV - Server codeWINDEV MobileWindowsNative Accesses

3. Loop used to get information about a serial port

Code triggering the warning
// Event calling a procedure.
// The EndProgram function is used in this procedure
LOOP
        // Loop process to retrieve the information
        Multitask()
END
Possible correction
No correction is required. EndProgram is used to end the process.
Minimum required version
  • Version 0
This page is also available for…
Comments
Click [Add] to post a comment