That does not work in VS because it's only standard in C99, and VS does not support C99. Since gcc supports C99 anyway, allowing c++ to do it too is an easy extension, but you should absolutely not write C++ that way if you have any expectation of portability.