delphi中关于字符串数组的一个小BUG
看如下代码:
var
buffer:array [0..6] of char;
begin
buffer:='delphi';
end;
编译通过
再看如下代码:
var
buffer:array [1..7] of char;
begin
buffer:='delphi';
end;
编译错误:
Incompatible types: 'Array' and 'String'
真不知道上面的区别有什么意义
相关文档:
在Delphi中,Inifiles单元中有一个TStringHash的类,不过它的Value仅支持Integer(其实也不是问题,有其它类型可以将变量变为Pointer),有点不舒服,今天没事做就把它替换为variant了,其中Key的名称大小写无关,就是为了加快开发速度!
使用Hashtable,查找和删除复杂度都是常数级别的!
type
PPHashItem = ^PHashItem;
......
技术交流,DH讲解. 在D2010的classes中有个TBits类,这个类主要是位操作的. TBits = class
private
FSize: Integer;
FBits: Pointer;
procedure Error;
procedure SetSize(Value: Integer);
procedure SetBit(Index: Integer; Value: Boolean);
function GetBit(Index: Integer): Boole ......
DELPHI用得不太多,加上脑筋不好使,就记一下最常用对开发效率很有帮助的几个:
Ctrl+鼠标左键:查找定义
Ctrl+Shift+↑:上一操作与其正好相反,由定义查找实现
Ctrl+Shift+空格:在一个函数没有输入参数的括号内按下此快捷键时会出现函数相关参数的提示信息,包括重载的所有函数的信息 ......
Procedure OnMouseWheel(Var Msg :TMsg;var Handled:Boolean);
begin
if Msg.message = WM_MouseWheel then
begin
if Msg.wParam > 0 then
begin
if DBGrid.Focused then
......
//Delphi部分
//回调函数定义
type TOnMyCallBack = procedure(data:pchar; id:Integer);stdcall;
//DLL中的导出函数声明
procedure StartCall(param: TOnMyCallBack(data:pchar; id:Integer);stdcall;
begin
...
...
end;
&n ......