Documentation for Val() might be improved.
The documentation for Val() currently states: "... stores this value in the variable V, which can be of type Longint, Real and Byte ..."
When V is of an integer type, it can however be any integer type (except ByteBool, WordBool, LongBool and QWordBool, which the docs state are integer types also).
Also, in light of the current patches for Val (see source#39406 (closed) and possibly source#15633 (closed)) we might also want to clarify the exact meaning of doesn't succeed
in the sentence "If the conversion doesn't succeed, the value of Code indicates the position where the conversion went wrong."
I propose to document that: For integer types:
- If S represents a numerical value in decimal notation, or a negative number, then the numerical value must fit into the range of the type of V, otherwise Val() does not succeed.
- If S represents a numerical value in binary, octal or hexadecimal notation, and does not contain a minus sign, then the numerical value must fit into the unsigned counterpart of the type of V and will be casted to the type of V, otherwise Val() does not succeed (e.g. Val('$FF', ShortIntValue, Code) will set ShortIntValue to -1).
Maybe some more examples to illustrate the above.
(Please don't care about the grammar/correct use of language for now.)