On Thursday, 10 March 2016 at 17:43:08 UTC, Taylor Hillegeist wrote:
I suppose the linker optimized the functions away since they are now in their own section. But it seems a hacky way to do this.

AFAIK assert(0) and other falsey assert have a special meaning for compiler. So probably it's not so hacky but just a way to say that case can't happen.

It is used also for:


auto myfunc(int i)
{

   if (i == 0) return 10;
   else if (i == 1) return 3;

   assert(0);
}

And also with non final switch using

switch(var)
{
   case ...
...
   default: assert(0);
}

Reply via email to