Disabling All Inlining in DMD Debug Builds

Imperatorn johan_forsberg_86 at hotmail.com
Mon Oct 24 19:45:36 UTC 2022


On Monday, 24 October 2022 at 19:28:34 UTC, Jack Stouffer wrote:
> I use
>
> ```
> pragma(inline, true)
> function definition
> ```
>
> all over my code. And by default, DMD inlines these functions 
> even in debug builds, which normally is great. I have a custom 
> dynamic array container and if the indexing operator overload 
> function wasn't inlined the debug build would have a ~10x 
> slowdown and become un-testable in many ways.
>
> What sucks about this is that stepping through the code in a 
> debugger is way worse because the the "step-over" operation no 
> longer works properly. Maybe this is a bug in the PDB output, 
> but trying to step over an inlined function call still takes 
> you into the inlined function body as if it were a step-in.
>
> So is there a way to tell DMD to ignore these pragmas in 
> certain builds?

Search and replace pragma(inline, true) with //pragma(inline, 
true) ;)


More information about the Digitalmars-d-learn mailing list