HomeDelphiDelphi Error – W1068 Modifying strings in place may not be supported in the future

Delphi Error – W1068 Modifying strings in place may not be supported in the future

Delphi Compiler Error

W1068 Modifying strings in place may not be supported in the future

Reason for the Error & Solution

As a warning, this message indicates that you are modifying a string in place. For example, the following common operation (indexing into a string and modifying the string) cannot be done with immutable strings:

 S[1] := 'A';

If you use a string operation such as this, the Delphi mobile compilers emit warning ‘W1068: Modifying strings in place may not be supported in the future.’

You should be aware that this fairly common practice might not be supported by future language changes in the Delphi desktop compilers. At that point in the future, this warning is to be replaced by an error.

Immutable strings (meaning that strings cannot be indexed and edited) are supported by the Delphi mobile compilers; DCCIOSARM and DCCIOS32 support only immutable, 0-based strings.

For string handling, use functions.
For editing a string in place, use .

To test immutable strings, do one of the following:

  • Set the compiler directive {$WARN IMMUTABLE_STRINGS <ON|ERROR>}.
    • ON enables the warning W1068 to display whenever your code modifies strings in place.
    • ERROR enables this message as an error, E1068.
  • On the page, set the warning “Modifying strings in-place….” to “True” or “error”.

See Also

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...