0

By mistake I added an extra comma in a brace initialization list, like this:

int main()
{
    int myArray[10]{0,}; // how is this parsed?
}

I know very well what myArray[10]{0} does, however adding this extra comma shouldn't be parseable in my opinion. I don't think it is a comma operator, as I haven't seen any comma operator having "nothing" on its right hand side. So why does it compile successfully? (both on g++ and clang++)

vsoftco
  • 52,188
  • 7
  • 109
  • 221

0 Answers0