printf() metaprogramming challenge

Andrei Alexandrescu SeeWebsiteForEmail at erdani.com
Fri May 24 14:12:47 UTC 2019


On 5/24/19 8:14 AM, Petar Kirov [ZombineDev] wrote:
> On Friday, 24 May 2019 at 09:52:58 UTC, Radu wrote:
>>
>> Yes, good point! I forgot about this trick.
> 
> Best verified on d.godbolt.org. Compare:
> 
> * https://d.godbolt.org/z/E8aoBg - compiles without -betterC, generates 
> a ton of bloat
> 
> * https://d.godbolt.org/z/GGh9c1 - same, but doesn't compile with -betterC
> 
> * https://d.godbolt.org/z/mPQMcc - compiles with -betterC
> 
> * https://run.dlang.io/gist/run-dlang/1caf15c8c7dded16ba812353361feda9 - 
> what I would like to write, but currently produces too much bloat and 
> doesn't work with -betterC
> 
> The examples above, were inspired by 
> https://twitter.com/Cor3ntin/status/1127210941718962177. I wanted to 
> check how D with -betterC would compare to C++23+ w.r.t code gen (bloat).

Interesting. These problems seem to be implementation-specific, not 
fundamental.



More information about the Digitalmars-d mailing list