The following code in Delphi 2007 gives me a warning
W1047 Insecure code '@operator'
on the line that passes @ThreadNameInfo to RaiseException:
procedure SetThreadName(const _Name: AnsiString);
var
ThreadNameInfo: TThreadNameInfo;
begin
ThreadNameInfo.FType := $1000;
ThreadNameInfo.FName := PAnsiChar(_Name);
ThreadNameInfo.FThreadID := $FFFFFFFF;
ThreadNameInfo.FFlags := 0;
try
RaiseException($406D1388, 0, SizeOf(ThreadNameInfo) div SizeOf(LongWord),
@ThreadNameInfo);
except
end;
end;
Besides disabling the compiler warning for βunsafe code,β is there any other way to get rid of this warning? Does this warning even make more sense since Delphi no longer supports dotNET?
I tried to explicitly specify the parameter in PDWord (the declared type of the last parameter), which did not change anything.
source
share