On Thursday, 10 March 2016 at 22:07:23 UTC, Andrea Fontana wrote:
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);
}

I'm good with the assert(0), I'm not so happy with the linker not being able to create a binary without the -ffunction-sections option.

I think there needs to be a ctimport keyword or something. I should not have to deal with the imports only used during compile time. it is not a good thing.

Reply via email to