Re:Learning that you can use unions in C for grouping things...
by shultays on Sunday August 01, 2021 @09:36PM
(#28032015)
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
[ Parent
| on HN ]
Re:Learning that you can use unions in C for grouping things...
by WalterBright on Sunday August 01, 2021 @11:28PM
(#28032575)
> 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.
Re:Learning that you can use unions in C for grouping things...
by shultays on Monday August 02, 2021 @05:27AM
(#28034565)
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
Re:Learning that you can use unions in C for grouping things...
by WalterBright on Monday August 02, 2021 @02:05PM
(#28040371)
Or go up an abstraction layer so the type details are not needed.