I seriously doubt cmd.exe ever uses the system() function.
|I think that if someone is going to be telling a beginner to use this to pause their program, they should at least give a thorough explanation of what they're writing. I think otherwise this advice can start a bad habit of copying and pasting snippets of code they don't understand to solve they're problems.|
Yeah, that's a good point. It isn't difficult to explain, though: effectively, it tells the user to press ENTER (unless 'false' is passed for 'prompt') and then waits until they do.
|Security, performance and resources issues. Which aren't beginner topics anyway.|
No, but they don't have to be explained in detail. You can literally just say "it's not safe, it's slow and it doesn't work on everyone's system". If someone asks for more detail you can give it - "it could run a malicious program with the same name, it requires the operating system to search for, load and run another executable instead of just waiting for input, and the 'pause' command generally only exists on Windows and DOS, and on other systems may do something completely different than what you expect".
|First and foremost I advocated that they should run their programs in the console. I do not consider that ignore() is the way to go, and just because you do prefer ignore() to system("PAUSE");, it doesn't make the former the better/right way, and also I'm getting tired of that meaningless cliche without a context.|
But ignore is
better, not just because I say it is, but because it really is better in every way, with the possible
exception of obviousness. It is well-documented what ignore() does. It is required to behave (or act as if it behaves) the same way on any system which has a compliant C++ library. It doesn't require you to assume anything except that the implementation you are using complies with the standard, which is a fair assumption to make, because without a compliant standard library implementation there's hardly anything useful you can do in C++ because there are no built-in I/O facilities.
system("pause"), on the other hand, requires you to assume (1) that an executable called 'pause' exists, (2) that the OS can find it, (3) that the OS can load & run it, and (4) that it pauses the program and waits for input. And that is on top of the other issues inherent to using system() in the first place. There is literally no reason to teach it. Yes, people should run their programs in the console or use an IDE that pauses the console for them, but they don't always do that. The next best thing is to just use ignore().
|Lastly, I do honestly apologize for strawman attacks.|