C macros vs D can't do the right thing

David Nadlinger via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 3 07:15:08 PDT 2017


On Saturday, 3 June 2017 at 13:17:46 UTC, Russel Winder wrote:
> Is this a problem in D or a problem in DStep?

It's a limitation of DStep – for that use case, it would need to 
transform one of the macro arguments into a template argument 
rather than a runtime function parameter.

If you need to make the code work as-is, I suppose you could 
create some aliases like `enum u32 = __u32.init;` and pass these 
instead of the types – using runtime values just to convey their 
type.

  — David


More information about the Digitalmars-d-learn mailing list