printf() metaprogramming challenge

Sebastiaan Koppe mail at skoppe.eu
Fri May 24 08:47:46 UTC 2019


On Friday, 24 May 2019 at 08:00:31 UTC, Petar Kirov [ZombineDev] 
wrote:
> In cases like this, one needs to use the enum lambda trick:
>
> // Before:
> string foo(string arg1) { /* .. */ }
>
> // After:
> enum foo(string arg1) = () { /* .. */ };
>
>
> (Replace `string arg1` with all compile-time and run-time 
> parameters that `foo` may take.)
>
> That way, `foo` won't reach the code-generator and hence you 
> won't get errors with `-betterC`.

Ohh, that is nice one. Thanks!


More information about the Digitalmars-d mailing list