Delphi Error – W1057 Implicit string cast from ‘%s’ to ‘%s’

Delphi Compiler Error

W1057 Implicit string cast from ‘%s’ to ‘%s’

Reason for the Error & Solution

Emitted when the compiler detects a case where it must implicitly convert an AnsiString (or AnsiChar) to some form of Unicode (a UnicodeString or a WideString). This warning is on by default.

To avoid this warning, you need to explicitly typecast your AnsiString to the new string type (UnicodeString), as follows:

<your_target_string> := string(<your_ansi_source);

The warning is also given for assigning a UTF8String value to an instance of UnicodeString or WideString, in which case you can use an explicit cast to UTF8String.

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...