CnPack Forum


 
Subject: 函数列表“Match All Parts”在10.4不对
hq200306
灌水科科长
Rank: 3Rank: 3



UID 67758
Digest Posts 0
Credits 106
Posts 36
点点分 106
Reading Access 10
Registered 2012-12-1
Status Offline
Post at 2020-5-29 22:07  Profile | Blog | P.M. 
函数列表“Match All Parts”在10.4不对

我从github下了最新的cnpack,编译安装在10.4,发现函数列表“Match All Parts”在10.4不对,只能匹配一个字符,但10.3的正确


Image Attachment: 函数过程列表.png (2020-5-29 22:07, 106.66 K)

Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2020-6-2 11:32  Profile | Blog | P.M. 
已修正,下一每日构建版鸡翅。

原因是10.4的编译器对PChar与Char形式的转换做了限制,导致行为改变了,详情如下:

假设有一个函数,用PWideChar类型的参数来实际传递一个WideChar,(嫑笑,好多个Windows API就是这么设计的):

function Test(C: PWideChar): WideChar;
begin
  Result := WideChar(C);
end;

假设如此调用:

var
  C: WideChar;
begin
  C := 'a';
  C := Test(PWideChar(C));

10.3或以下版本,C仍然得到'a'。但10.4版里,C就得到一个乱码。
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2020-6-2 11:33  Profile | Blog | P.M. 
鸡翅->集成。
Top
hq200306
灌水科科长
Rank: 3Rank: 3



UID 67758
Digest Posts 0
Credits 106
Posts 36
点点分 106
Reading Access 10
Registered 2012-12-1
Status Offline
Post at 2020-6-2 16:38  Profile | Blog | P.M. 
试了,现在可以了
Top
hq200306
灌水科科长
Rank: 3Rank: 3



UID 67758
Digest Posts 0
Credits 106
Posts 36
点点分 106
Reading Access 10
Registered 2012-12-1
Status Offline
Post at 2020-6-2 16:43  Profile | Blog | P.M. 
//pascal

function Test(C: PWideChar): WideChar;
begin
  Result := C^;
end;
//

var
  C: WideChar;
begin
  C := 'a';
  C := Test(@c);

[ 本帖最后由 hq200306 于 2020-6-2 16:51 编辑 ]
Top
hq200306
灌水科科长
Rank: 3Rank: 3



UID 67758
Digest Posts 0
Credits 106
Posts 36
点点分 106
Reading Access 10
Registered 2012-12-1
Status Offline
Post at 2020-6-2 16:56  Profile | Blog | P.M. 
我对比了下10.4,10.3的汇编,10.4编译器将“a”转成字符串,再调用,区别太大了

var
  C: WideChar;
begin
  C := 'a';
  C := Test(PWideChar(C));
Top
 




All times are GMT++8, the time now is 2024-11-21 20:37

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.008984 second(s), 8 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP