Var-string checking (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Delphi 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 Delphi code that uses short strings, and is provided for backwards compatibility with early versions of Delphi 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