I have a well above basic knowledge about C++ (variables, arrays, functions, classes, virtual functions, polymorfism, templates etc.), but there is one thing that has paid my attention:
1 2 3 4 5 6 7
#include <iostream>
usingnamespace std;
int main(){
system("PAUSE");
return 0;;;;
}
I discovered this by total accident. It has bothered me, because to my knowledge, this probably shouldn´t be legal C++ code albeit compilers, both DevC++ and Visual Studio, accept it without any warnings or errors. Any ideas about this thing´s correctness?
Be careful not to fall into the common trap of believing that the tool made a mistake. People make mistakes. While tools also fail, it is usually the result of misuse or abuse. When there is a genuine error in a tool, people more experienced than you or I and much more familiar with the tool than you or I will already know about it and be working on fixing it, and in the meantime will have the problem listed for the users of the tool.
Thanks for the replies. I agree with Duoas, I´d better believe I´ve made a mistake myself, but because this one seemed so weird, I had to ask further information about it. But why that kind of thing has actually been left into C++? Does somebody really want to code like that?
Well, anyway, I think I have found answers good enough, but of course I´d like to see more feedback and other opinions, too. Thanks again so far.
Sheesh, you´re right, I forgot that. I seem to keep forgetting things, although I have used that more than once. That´s definitely useful of course. Good point.