Today i was Just looking through my book and than i just wanted to try something from the book and when i tried it my pc crashed...Now dont say my pc is crap
Proc: AMD phenom II 1.8 GHz Quad Core
Ram: 4 gig
hardrives : one 500 gb and one 320 gb
graphics card: nvidia gt 430
and i have 5 fans cooling it with blue leds
Here is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// WRONG: u can never be less than 0; the condition will always succeed
//THIS WILL CRASH!!!!!!
for (unsigned u = 10; u >= 0; --u)
std::cout << u << std::endl;
Cooling wouldn't really be the issue, you probably have bad memory that you don't normally use til this program expended all of it. Only people that jump to the conclusion a computer is shitty because something didn't work are those uneducated with the ways of the force hardware. So many things can go wrong with the manufacturing of hardware, something as small as a hair can cause a circuit to malfunction. It's not uncommon to get brand spanking new defective hardware.
Yes. But depending on the OS, it might not hang the system.
Linux will either kill the process, or the process will simply silently fail to allocate memory and continue in the loop while nothing happens to the rest of the system, or the OOM in the kernel may start killing random things. This all depends on how that system's kernel is configured.
The last time I tried it on Windows, the kernel will just kill it when it uses too much memory. I don't know if there is a way to change this, I've never bothered to look.
Last time I tried that on a Mac, OS X simply continued to expand the swap file until the entire system was unusable. I don't know if this can be configured, or has changed in recent version of OS X.