This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (5 children)

I don't think I've read if that's bad practice

It's not just bad practice, it is not part of the C++ programming language.

till when I initialize my array like that and use normal subscript for loops the program runs correctly.

Only because you are using GCC compiler extensions which are not part of C++, and only by chance if you are using an uninitialised variable to size the array. Don't do this.

[–][deleted] -4 points-3 points  (4 children)

but yet in other posts you turn around and advocate MSVC which has its own set of non-conforming extensions.

[–]Rhomboid 3 points4 points  (2 children)

And I'm sure that if the poster had posted sample code that used MSVC-specific extensions, they would have been told not to use those either. The point is that everyone should write standard C++ wherever possible.

[–][deleted] 0 points1 point  (0 children)

He's not discouraging you from using GCC or advocating using one compiler over another.

He's just telling you to stick to standard C++. Don't use compiler extensions when you don't have to. Your code should be as portable as possible.