Var-string checking (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Object Pascal Compiler Directives (List) Index

Type

Switch

Syntax

{$V+} or {$V-} {$VARSTRINGCHECKS ON} or {$VARSTRINGCHECKS OFF}

Default

{$V+} {$VARSTRINGCHECKS ON}

Scope

Local



Remarks

The $V directive is meaningful only for Object Pascal code that uses short strings, and is provided for backwards compatibility with early versions of Object Pascal and Object Pascal.

The $V directive controls type checking on short strings passed as variable parameters. In the {$V+} state, strict type checking is performed, requiring the formal and actual parameters to be of identical string types. In the {$V-} (relaxed) state, any short string type variable is allowed as an actual parameter, even if the declared maximum length is not the same as that of the formal parameter.

See Also