Type violation

from Wikipedia, the free encyclopedia

A type of injury ( engl . Type conflict ) exists when data types , for example, due to lack of assignment compatibility are not used in accordance with rules.

For example, variables are assigned data types, which restricts their range of values , i.e. the amount of permissible assignments of the variable with a specific value.

If you then, for example, assign an integer to a variable that is to hold a character string , a type violation has occurred. There are programming languages ​​that would implicitly do a type conversion here , such as PHP (see also weak typing ) and consequently no runtime error would occur. This reduces the programming effort, but makes it more difficult (if the conversion is unintentional) to detect errors.

See also