Skip to main content
GameDev.net gamedev.net
🔒 Locked

pointers are dangerous apparently

Started by sixteen Feb 13, 2006 at 6:08 PM 8 replies 1.5k views
Original Post
sixteen
sixteen
I was messing around with getting text to appear on screen and after a while I decided to reboot my computer. Well, it got to the logon screen and then my computer decided to shut down. Fluke I supposed. I tried again. Same thing. Got a little sweaty under the collar. Tried booting into safe mode. Same thing. I ended up having to go through the emergency recovery console on my OS disc (which I luckily still have) to fix Windows. It finally worked, but not without adverse effects. My Administrator profile apparently remained corrupted, so I had to recreate it. Ended up dealing with a slew of other problems, but I won't go into those. The reason behind all this chaos? I believe it was because I didn't set a pointer in my program = to NULL. I'm guessing that it decided to point to some random memory location and started screwing around with it. I'm guessing that memory location was held by Windows and some of the other applications that I had to reinstall afterwards. NULL sets it to location 0x000000 or whatever it is. Which is safe. My question is this: if pointers are capable of this type of damage, is there anything else I should be aware of before I go a-programming again? I don't want to have to reinstall IE6, the MSDN Library, run through the emergency recovery console, and change shirts four times because I'm sweating about losing my data on my hard drive again.
Sneftel
Sneftel
Such things are not normal. Modern operating systems have mechanisms in place to make it impossible for programs to affect things outside their personal memory space, especially accidentally. While the use of system APIs like DirectX--which, due to efficiency requirements, must be relatively low-level and unchecked--makes it a little more dangerous, I VERY much doubt that a null pointer crash caused your problem.
RDragon1
RDragon1
Yeah, doesn't sound even remotely likely.
RenderTarget
RenderTarget
I would lean towards a disk failure maybe. Scan your HDD.
[sub]My spoon is too big.[/sub]
Noplace
Noplace
As far as i know, windows gives each program its own virtual memory space and doesn't allow any sharing of memory via a simple pointer,it's probably something else.
DXnut
DXnut
Man, I have managed to wreak all kinds of havoc in Visual Studio 2003 with my DirextX programs, but I never had that happen. Once, I even managed to completely lock up windows XP pro. Even the mouse froze. It turned out to be a problem with my interface to my shader.

I get access violations and assert failures a lot as I develop and test. I would bet it is something else, like a virus or hardware failure.
--------------------------Most of what I know came from Frank D. Luna's DirectX books
xeddiex
xeddiex
I once was messing with pointers for some useless test and I remember printing an uninitialized char pointer to the console window and what it printed was "Windows Service Pack 2". I was like [oh] Hehe.
one..
RAZORUNREAL
RAZORUNREAL
Worst I've had is a sudden reboot. And I know it was my program, cause it happened every time till I fixed it (can't remember how). Quite hard to hunt that sort of thing down actually.
___________________________________________________David OlsenIf I've helped you, please vote for PigeonGrape!
Iftah
Iftah
scan your computer for virus, check your hard disk, check for updated drivers (did you add a new hardware lately?)

when you write to an uninitialized pointer the OS detects it and safely closes your application with segmentation fault (unless you are using win98). This is one of the benefits of virtual memory. You have to work hard (use special API's) to access other process memory.
Also, even if you somehow destroy OS memory it should be fine after reboot. To make an error stay after a reboot it must be on the harddisk so unless you wrote junk into OS DLL's you most likely have a harddisk failure or evil virus.

a not so related side note:
I had nasty problems with my PC that I ended up formatting and reinstalling everything, and the problems persisted. Then I found out one memory chip wasnt pushed in all the way...

Iftah
Blew
Blew
Quote:
Original post by sixteen
I don't want to have to reinstall IE6

I think that's what's screwing up your computer. Use Firefox instead. [grin]
blew

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.