KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: What is a Runtime error?
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: June 15, 2001
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

A Runtime error is usually related to the use of memory. It is a type of error that cannot be detected at the compilation time and only occurs during the execution of a program. It most often occurs when non-allocated memory is being referenced; this non-allocated memory can be referred to as memory that has not been properly allocated and initialized by 4D.

For example:

C_STRING(3;vString1)
C_STRING(3;vString2)
vString1:="ABC"
vString2:=vString1[[4]]

In the above example, vString1 is declared to have a maximum size of 3 characters. 4D allocates a specific location in the memory to support each character. As you can see, an attempt to access the fourth character in the string is basically asking 4D to retrieve a character from an unknown location in the main memory. If the database is compiled with the range checking option turned on, 4D will display a Runtime error dialog box with a useful explanation about this error. If the database is compiled without the range checking option turned on, 4D will not generate an error message. It will attempt to use the invalid value from the referenced memory location without checking it in which can cause unpredictable results or crash 4D