Wiki Home

Run - Time Errors

Namespace: Wiki
Run-time errors happen as the program is executing.

Strongly Typed languages like C++, Java and Delphi can determine at compile time if an expression is using incompatible data types.
int iTest;
String cTest;
int iResult;

fResult = iTest + cTest;

A C++ compiler can generate a syntax error when it detects the attempt to add a String variable to an int variable (assuming here that the String class doesn't have an overloaded + operator that defines the operation).

Weakly Typed languages like VFP allow variables to change type at runtime:
iTest = 27                 && make iTest an integer
iTest = "Now I'm a String" && perfectly legal in VFP
? iTest + 53               && causes a runtime error

so the compiler cannot detect the same error because the error won't happen until run-time.

This weak-typing has many pluses in VFP, it also has a few problems because typo errors in the source code are not caught at compile time. VFP does have a good tool in the Coverage Profiler that can help assure that all of your code is tested prior to release. It is a frequently requested enhancement to allow some form of strong typing in VFP.
See also Compile - Time Errors
Category VFP Troubleshooting
( Topic last updated: 1999.10.09 10:45:56 PM )