LDC 1.15.0

jmh530 john.michael.hall at gmail.com
Fri Apr 12 13:26:14 UTC 2019


On Saturday, 6 April 2019 at 17:40:39 UTC, kinke wrote:
> 
> * New generic @llvmAttr("name") parameter UDAs, incl. @restrict 
> with C-like semantics.
> [snip]

I think I had passed over this when I first read the 
announcement. The @llvmAttr("noalias") compiled on run.dlang.org, 
but I couldn't get the @restrict to work. I assume that uses the 
most recent version of LDC, but I don't really know.

Hmm, given that these work in LDC and not DMD, making code that 
uses it compiler-agnostic might be a little more roundabout. The 
best I could think of was something like below, unless you have 
other recommendations.

version(LDC) {
      import ldc.attributes;
}

mixin template fooImpl() {}

version(LDC) {
      void foo(@llvmAttr("noalias") void* p) {
           mixin fooImpl;
      }
} else {
      void foo(void* p) {
           mixin fooImpl;
      }
}

void main()
{

}



More information about the Digitalmars-d-announce mailing list