DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: cdk19821
今日帖子: 32
在线用户: 16
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 speedbin (speedbin) ★☆☆☆☆ -
盒子活跃会员
2023/4/24 17:54:11
标题:
最近我发现部分VCL源代码并不是完美。 浏览:1209
加入我的收藏
楼主: 直接看图吧,文字不给过审,又不指出哪里有问题,中文版看图。
以下给外国有人看的,直接百度翻译。

From Baidu Translator:
Just look at the picture, the text will not be reviewed and there will be no indication of any issues.

The reason is that I recently wanted to use VC to encapsulate read and write ini files, so I referred to VCL's TIniFile. However, I found that its source code is not the best, and it is not even as cross platform as Lazarus.

Let's talk about it:

1. If it does not exceed the section content and does not exceed 16K, then it will be read directly without recalculation. If it exceeds 16k, complex calculations are used, the entire file is read in, and then recalculated, there is actually a problem here. Since we have already read the entire file, why do we need to recalculate it? This is not unnecessary, and it also consumes twice the memory space.



2. Delphi did not have the time to read ini on its own, but instead used the Windows API. There was a problem with the API. When the file was UTF-8, it read garbled code, and Delphi did not handle it. Moreover, the API itself does not support Chinese as section and key names. Of course, this is not a problem with Delphi, but with the Microsoft API.



3. Compared to Lazarus' implementation, it uses its own way of reading and writing, and achieves cross platform performance. Delphi can only be bound to the Windows platform using APIs, of course, ini itself is a thing of the past for the Windows platform.
此帖子包含附件:
PNG 图像
大小:89.4K
----------------------------------------------
-
作者:
男 speedbin (speedbin) ★☆☆☆☆ -
盒子活跃会员
2023/4/24 23:22:28
1楼: 论坛人好少啊,没人发表点意见吗?
----------------------------------------------
-
作者:
男 powerpcer (大强) ★☆☆☆☆ -
禁用账号
2023/4/24 23:27:59
2楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
呆湾傻冒
作者:
男 stacker (OOP才是王道) ★☆☆☆☆ -
普通会员
2023/4/25 1:30:52
3楼: 用json?
----------------------------------------------
-
作者:
男 speedbin (speedbin) ★☆☆☆☆ -
盒子活跃会员
2023/4/25 2:11:37
4楼: 我用的是visual C++,主要是想封装一下读取INI所以就参考了一下delphi的源码,结果发现delphi的TTniFile源码实现其实也有一些不是很好的地方。
----------------------------------------------
-
作者:
男 ooolinux (ooolinux) ▲△△△△ -
普通会员
2023/4/25 3:51:32
5楼: TMemIniFile更好
----------------------------------------------
-
作者:
男 powerpcer (大强) ★☆☆☆☆ -
禁用账号
2023/4/25 8:12:52
6楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
呆湾傻冒
作者:
男 hs_kill (lzl_17948876) ★☆☆☆☆ -
普通会员
2023/4/25 8:40:50
7楼: tmeminifile了解一下, 跨平台, 自己实现ini读写, 支持utf8
----------------------------------------------
http://www.cnblogs.com/lzl_17948876/
作者:
男 hardnut (麦轲数据管家) ★☆☆☆☆ -
普通会员
2023/4/25 15:38:38
8楼: 是的,   TMemIniFile 是正解,没有那么多限制。但原生 TMemIniFile 还是比较弱,不支持Int64,UInt64, stream等,要自己扩展
----------------------------------------------
UniKeeper V10.40 -- 您最贴心的个人数据管理助手
作者:
男 hardnut (麦轲数据管家) ★☆☆☆☆ -
普通会员
2023/4/25 15:40:37
9楼: 另外 TIniFile.ReadString 最多最读取 2047 个字符,  TMemIniFile 没有这个限制
----------------------------------------------
UniKeeper V10.40 -- 您最贴心的个人数据管理助手
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行70.3125毫秒 RSS