Compiler Hint: “Inline function '…' has not been expanded…”

后端 未结 4 1161
难免孤独
难免孤独 2021-02-19 05:06

In a unit I use the function DeleteFile and the compiler outputs a hint:

\"H2443 Inline function \'DeleteFile\' has not been expanded because

4条回答
  •  滥情空心
    2021-02-19 06:01

    It's an inlining restriction.

    See Hallvard Vassbotn's article about Inlined Routines.

    Extracted from that site:

    The rest of the inlining restrictions are common for both platforms and the most important ones are

    • no inlining across package boundaries
    • the inlined routine cannot access implementation section identifiers
    • the call site must have access to all identifiers used in the inlined routine

    Note The last point means that unless the call site unit uses the units required by the routine, the routine cannot be inlined. When this happens, the compiler emits a hint like this

     [Pascal Hint] InlinedRoutinesU.pas(14): H2443 Inline function 
       'InlineMe' has not been expanded because unit 'RequiredUnit' 
        is not specified in USES list 
    

    To resolve the issue, add the missing unit name to the call site's uses clause.

提交回复
热议问题