Jump to content
Steve Maughan

Removing Hints & Warnings — Specifically, "H2443 Inline function"?

Recommended Posts

I have a confession: I'm terrible at ensuring there are no Hints or Warnings in my code. That's all got to stop now that I have switched to 10.4.2 — the IDE now scream at me to fix these Hint and Warning (that's a good thing)!

 

One hint that crops up a lot in my code is H2443 Inline function. Typically it says something like:

H2443 Inline function: TOptimizer.Execute has been expanded because unit 'TAnneal' is not included in the USES list

What is this all about? Clearly the code runs without TAneal in the USES list and I like to minimize the number of units in the USES list. The hint goes away if I add TAnneal to the USES list but what's the advantage of including it — my code is cleaner and runs just fine if I don't include it.

 

Also, does anyone have a tutorial on getting rid of Delphi Hints and Warnings? Some are obvious, others (like this one) are not so obvious.

 

Thanks,

 

Steve

Share this post


Link to post
46 minutes ago, Steve Maughan said:

Clearly the code runs without TAneal in the USES list and I like to minimize the number of units in the USES list.

Right, it will simply NOT inline that function and that means there is a Jump.. inline is faster..

 

..more on those for Rio

Share this post


Link to post

Side note: inlining is not necessary faster.

Sometimes, after inlining the compiler has troubles assigning properly the registers: so a sub-function with a loop is sometimes faster when NOT inlined, because the loop index and pointer could be in a register, whereas once inlined the stack may be used.

 

The worse use of "inline;" I have seen is perhaps the inlining of FileCreate/FileClose/DeleteFile/RenameFile from SysUtils which required the Windows unit to be part of any unit calling it.

With obviously no performance benefit because those calls are slow by nature.
Embarcadero made this mistake in early versions of Delphi, then they fixed some of it (but RenameFile is still inlined!), and re-used "inline;" when POSIX was introduced... 😞
I had to redefine those functions in mormot.core.os.pas so that I was not required to write {$ifdef MsWindows} Windows, {$endif} in my units when writing cross-platform code...

 

 

  • Like 1

Share this post


Link to post
16 hours ago, Arnaud Bouchez said:

Embarcadero made this mistake in early versions of Delphi, then they fixed some of it (but RenameFile is still inlined!), and re-used "inline;" when POSIX was introduced... 😞

I've never seen FileCreate/FileClose  inlined; DeleteFile is inlined for Posix and yes, RenameFile is still inlined for all platforms (checking in XE2 and 10.3). Odd decision really.

 

The worse thing with inlines is that they can't use internal constants 😞

Edited by Fr0sT.Brutal

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×