Si tratta di un bug del compilatore?Perché non riesco a utilizzare le intrinseche del compilatore in un blocco asm?
program Project44;
{$APPTYPE CONSOLE}
uses
System.SysUtils;
function Test: integer;
asm
xor eax,eax
add eax,SizeOf(NativeInt);
end;
begin
WriteLn(Test); //Typically outputs 31 or 49
{$ifdef CPUX86}
WriteLn('should be 4');
{$else}
{$ifdef CPUX64}
WriteLn('should be 8');
{$endif}{$endif}
ReadLn
end.
Questo programma genera tutti i tipi di cose, ad eccezione di 4/8.
Si tratta di un bug o è documentato che non posso utilizzare SizeOf e altri componenti intrinsechi del compilatore nell'assembler?
Se vorrei usare SizeOf(xx)
in un blocco asm cosa devo fare?
Immagino che il tuo codice sia solo un esempio illustrativo, quindi prendi questo come sidenote; in questo caso potresti dichiarare una costante. – TLama