Hello. I'd like to have: version (D_DebugInfo) {} else { version = enableFeatureThatIsAnnoyingWhenDebugging; } Is there a way to know if debug info is being emitted when compiling? "debug" is not cutting it because sometimes you really need to debug with or without -debug, and with or without -O. I would want -g.
There's now precedence for version identifiers based on codegen flags with `D_Optimized`: https://github.com/dlang/dmd/pull/14245 Still, I would like to have solid rationale before adding another. What kind of feature is annoying when debugging? Also, can't you pass `-g -version=disableFeatureThatIsAnnoyingWhenDebugging`?
Dplug software has a mouse hook that is active to allow using the mouse wheel when dragging outside of the window. Others OSes can do that, but Windows needs a mouse hook. When debugging, this is extra slow, but in normal times it is invisible. Hence, for practicality it's better to disable this. - D_Optimized is obviously not the same as D_Optimized, it's frequent to want to debug optimized builds - I don't see why -g would one of the only flags you can detect. -g is the closest flag to "I will debug this interactively". > Also, can't you pass `-g -version=disableFeatureThatIsAnnoyingWhenDebugging`? No. That doesn't solve the problem, as we use dub, and version identifiers are set by configurations not build types.
> D_Optimized is obviously not the same as D_Optimized Corerection not the same as D_DebugInfo*
> you can detect you couldn't* detect
Why D don't create corresponding versions for all simple flags? Some sample flags DMD -g -debug -inline will have following defined versions, Dflag can be shorten to Df Dflag_g Dflag_debug Dflag_inline so usage is version(Dflag_g) version(Dflag_debug) version(Dflag_inline)
That's not what this bug is about, it's just about -g