Conditionally set nothrow: for a block of code.
Uknown
sireeshkodali1 at gmail.com
Sun May 27 14:25:11 UTC 2018
On Thursday, 24 May 2018 at 18:51:31 UTC, Mike Franklin wrote:
> I'm trying to find a way to declare a block of code `nothrow:`
> when compiling with -betterC, but not `nothrow` when not
> compiling with -betterC.
>
> The solution is needed for this PR:
> https://github.com/dlang/druntime/pull/2184/files#r188627707
> [...]
> Given that the PR above is for object.d, I can't turn the
> entire object.d source file into a string and conditionally mix
> that in.
> Does anyone have a solution to this?
>
> Thanks,
> Mike
I think conditional application of attributes would be something
useful. Something like this:
version (D_BetterC)
enum BetterC = true;
else
enum BetterC = false;
nothrow!(BetterC):
...
Of course that would require a DIP though
More information about the Digitalmars-d-learn
mailing list