Jens Gustedt's Blog

May 11, 2015

The controlling expression of _Generic

Filed under: C11, defects, language — Jens Gustedt @ 22:06

Recently it showed that the C standard seems to be ambiguous on how to interpret the controlling expression of _Generic, the one that determines the choice. Compiler implementors have given different answers to this question; we will see below that there is code that is interpreted quite differently by different existing compilers. None of them is “wrong” at a first view, so this tells us that we must be careful when we use _Generic. In this post I will try to explain the problem and to give you some work around for common cases.



Create a free website or blog at