[fpc-pascal] How does inline work?
Thierry Coq
tcoq at free.fr
Sun Nov 22 10:10:37 CET 2009
Hello,
I'm trying to use inline to remove unnecessary debugging code, such as
the following code, with FPC 2.3.1 on Windows, when compiling for
production.
However when I compile the code, at O1 optimisation level (my default),
the call to DebugInfo is still present in the generated assembler.
Is there a way to completely remove a call to an empty non-virtual
operation without ifdefing it?
Best regards,
Thierry
>>>> Start of demo code... ><<<
{$Inline on}
type
TForm1 = class(TForm)
private
procedure DebugInfo; inline;
public
procedure DoSomething;
end;
...
Implementation
procedure TForm1.DebugInfo;
begin
{$ifdef debug}
DebugInfo
{$endif}
end;
procedure TForm1.DoSomething;
begin
DebugInfo;
end;
More information about the fpc-pascal
mailing list