Why does Delphi warn when assigning ShortString to string? -
I am converting some legacy code into Delphi 2010.
Old shortspring, like string [25]
Why is the assignment below:
Type S: string; Shorts: string [25]; ... S: = shorts;
The reason for the compiler to generate this warning:
The W1057 integer string was inserted from 'short string' to 'string'.
There is no data loss to be here. In what situation would I have useful information for this warning?
thanks
Tomw
short string type is not change Has happened. It's an array of examples, actually going on.
By specifying this as a string type, you are taking a group of AnsiChars (one byte) and putting it into a group of WideChars (two bytes). The compiler can do such a thing, and not enough to lose data, but the warning is to tell you that such a conversion has happened.
Comments
Post a Comment