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 E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...