Hacker News new | ask | show | jobs
by shultays 1779 days ago

   The optimizer will delete bar() if FOO is a manifest constant that is not 3. 
Yes, but the compiler won't delete it and complain if bar is not defined. if constexpr is not a direct replacement for if macro
1 comments

> the compiler won't delete it and complain if bar is not defined

    extern void bar();
will define it to the satisfaction of the compiler. The linker won't complain if the compiler removes the call to it.
And then you have the issue of not having types. consider this

  void my_bar_class_type::bar(my_bar_type<my_bar_type_2>::my_bar_inside_type paramater);
and you are calling something like

   myObject->bar(mySecondObject.getWhatever());
You have to mock up like everything
Or go up an abstraction layer so the type details are not needed.