Structure, union and enumeration types may be defined more than once in the same scope with the same contents and the same tag; if such types are defined with the same contents and the same tag in different scopes, the types are compatible.
以下的程式碼在C23是合法的
1 2 3 4 5 6 7
structA { int a; };
structA { int a; };
而在C23之前會被歸類成 redefinition of 'struct A' 有了這個,在C語言寫類Generic 會比較方便 例如
Result_t(int, ErrorMessage_t) my_func(int i) { if (i == 42) return Ok(int, ErrorMessage_t)(100); elsereturn Err(int, ErrorMessage_t)("Cannot do the thing"); }
intmain() { Result_t(int, ErrorMessage_t) x = my_func(42);