[cfe-dev] Designated initializer incompatibility

Rui Ueyama ruiu at google.com
Mon Apr 22 22:33:47 PDT 2013


Hi,

The following code outputs "10 11 0" with GCC, but "10 11 7" with Clang. Is
there anyone who knows which is correct? The C99 spec seems to be a bit
unclear about this.


#include <stdio.h>

int main() {
  int x[1][3] = {[0][2] = 7, [0] = {10, 11}};
  printf("%d %d %d\n", x[0][0], x[0][1], x[0][2]);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130423/a5d38047/attachment.html>


More information about the cfe-dev mailing list