DIP60: @nogc attribute

sclytrack via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 16 08:32:03 PDT 2014


On Wednesday, 16 April 2014 at 10:13:06 UTC, bearophile wrote:
> JN:
>
>> I doubt @nogc will change anything, people will just start 
>> complaining about limitations of @nogc
>
> Having a way to say "this piece of program doesn't cause heap 
> activity" is quite useful for certain piece of code. It makes a 
> difference in both performance and safety.
> But not being able to call core.stdc.stdlib.alloca in a "@nogc 
> pure" function sub-three is not good.
>
> Bye,
> bearophile

What about adding custom annotations that don't do any checking by
itself. Like when @nogc doesn't actually verify that the
~ is not used for strings.

void hello() require(@nogc)
{

}

Just a verification by the compiler that you use only routines
that are marked with certain annotations.

void boe()
{
}

@(nasaverified)
void test()
{
}

//

void hello() require(@(nasaverified))
{
   test(); // ok
   boe();  // not ok.
}
















More information about the Digitalmars-d mailing list