Re: [fpc-devel] Warning: Unicode constant cast with potential data loss

2020-09-17 Thread Tomas Hajny via fpc-devel

On 2020-09-17 15:37, Martin via fpc-devel wrote:

FPC 3.2.0

var
  u,u2 : UTF8String;

begin
  u := #$2267'x';
  u2 := #$2267;  // warning


Assigning a WideString to a Utf8String works without warning.

Assigning a WideChar (2nd line) to a Utf8String causes "Warning:
Unicode constant cast with potential data loss"
Apparently it is first converted to a char in the System codepage, and
then to string.

Is that intended?


FWIW, this looks similar to my observation described in number 2 at the 
bottom of 
https://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg53421.html


Tomas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Warning: Unicode constant cast with potential data loss

2020-09-17 Thread Martin via fpc-devel

FPC 3.2.0

var
  u,u2 : UTF8String;

begin
  u := #$2267'x';
  u2 := #$2267;  // warning


Assigning a WideString to a Utf8String works without warning.

Assigning a WideChar (2nd line) to a Utf8String causes "Warning: Unicode 
constant cast with potential data loss"
Apparently it is first converted to a char in the System codepage, and 
then to string.


Is that intended?

Actually if
  u: AnsiString

then the result is '??' (so data is lost), yet no warning.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Feature request/discussion - SetLengthNoInit

2020-09-17 Thread Ryan Joseph via fpc-devel


> On Sep 17, 2020, at 11:33 AM, J. Gareth Moreton via fpc-devel 
>  wrote:
> 
> I think the difficulty with getting things like this approved is that it 
> crosses into the realm of defining the language itself.  I can't say I speak 
> on behalf of Florian or Jonas, but I sense they want to avoid feature bloat 
> that became a bit of an issue with Delphi.

Certainly. I think it depends on what the solution is. It's a known short 
coming of the [] property and if the solution is as easy as allowing a var 
param variant then maybe it's feasible. 

Regards,
Ryan Joseph

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel