免费 Pascal 警告 "function result variable of a managed type does not seem to be initialized"
Free Pascal warning "function result variable of a managed type does not seem to be initialized"
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;
Warning: function result variable of a managed type does not seem to
be initialized
TBytes 声明:
TBytes = array of Byte;
如何修复此警告?
添加“结果:=nil;”
中进行了解释
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;
Warning: function result variable of a managed type does not seem to be initialized
TBytes 声明:
TBytes = array of Byte;
如何修复此警告?
添加“结果:=nil;”
中进行了解释