问题描述
Free Pascal 3.2.0发出有关类型为TBytes的函数结果缺少初始化的警告:
function ToBytes(const AValue: RawByteString): TBytes;
begin
SetLength(Result,Length(AValue)); <--- Warning
if Length(AValue) > 0 then
Move(AValue[1],Result[0],Length(AValue));
end;
警告:托管类型的函数结果变量似乎没有 被初始化
TB的声明:
TBytes = array of Byte;
如何解决此警告?
解决方法
添加“结果:=无;”
中进行了说明