Thread: Whats the worst that could happen?

  1. #1
    Unregistered
    Guest

    Whats the worst that could happen?

    Hey, this might be a kinda noob question, but I am just kinda nervous.

    If I type something wrong into a C++ program and run it, what is the worst it could do to my computer? Is it possible that accidentally iterating through the wrong set of pointers could do irreparable damage to my machine? (windows 98)

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    It's possible that you could do damage if you make an assignment to memory that you don't own. Though hopefully, and most likely, your compiler will catch it and warn your or the program will simply choke and do nothing untoward.

    The worst damage that I've heard of is a monitor being fried, but you can screw up just about anything that makes the computer run if you get unlucky enough, or possibly lucky enough if you consider that you found a bug in your program

    -Prelude
    Last edited by Prelude; 02-17-2002 at 03:56 PM.
    My best code is written with the delete key.

  3. #3
    Probably not, unless you want to program your own operating system and purposely do this. Don't worry, the way Windows or Linux is programmed, it would be pretty hard to screw up your computer unless you were programming drivers.
    What will people say if they hear that I'm a Jesus freak?
    What will people do if they find that it's true?
    I don't really care if they label me a Jesus freak, there is no disguising the truth!

    Jesus Freak, D.C. Talk

    -gnu-ehacks

  4. #4
    Seņor Member
    Join Date
    Jan 2002
    Posts
    560
    The worst that could realistically happen is your program crashes and windows xp gives you a message and asks you to send the problem to them. Just a nusiance. Chances are %99.999999 you won't mess your computer up. Especially if you are just using cout and simple stuff.

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    28
    Poking the wrong memory area can even reset your BIOS.

  6. #6
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    thats what happened to me...i will never use malloc() again.

  7. #7
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    >If I type something wrong into a C++ program and run it,
    >what is the worst it could do to my computer?

    Well... theoretically, you might be able to send out the pulse that sets off a nuke by chance and destroys the world. Practically, the worst thing that can possibly happen is that Windows crashes and you have to reboot.

    All the described horror-stories can happen. But then, going out and crossing a road can kill you, too. The risk you do something irreperable is minimal. I code for more than 5 years now, and I never did anything worse than what could be justified by a reboot to any machine I worked with.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    You can get all these if you read input from the user, and don't check the length

    http://www.google.com/search?hl=en&q...verflow+attack

  9. #9
    Registered User
    Join Date
    Aug 2001
    Posts
    47
    If you program in a protected mode environment like Windows, the chances of writing to memory and screwing something important up are just about zero.

  10. #10
    Registered User skyline's Avatar
    Join Date
    Dec 2001
    Posts
    49
    Originally posted by Manish
    Poking the wrong memory area can even reset your BIOS.
    that would suck... imagine corrupting your bios chip with junk, and your bios chip was soldered onto your motherboard. you might as well throw it away. but i don't think any high level lang. could do this by itself?

  11. #11
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >i will never use malloc() again.
    You're going to have a hard time programing in C/C++ without dynamic allocation. Why make it harder on yourself when a little extra awareness is so easy?

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. magic could happen on recvfrom
    By -EquinoX- in forum C Programming
    Replies: 22
    Last Post: 03-27-2009, 06:06 PM
  2. Games: The best and the worst!
    By CAP in forum A Brief History of Cprogramming.com
    Replies: 73
    Last Post: 10-13-2002, 09:40 PM
  3. worst time to program
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 06-10-2002, 11:32 PM
  4. Hey, what would happen if...
    By Imperito in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 04-05-2002, 08:54 AM
  5. What would happen?
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 04-04-2002, 10:54 AM