C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-26-2008, 01:36 AM   #46
Mysterious C++ User
 
Elysia's Avatar
 
Join Date: Oct 2007
Posts: 14,785
Just as a heads up, some debuggers (such as Visual Studio) will complain if you use uninitialized variables.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 09-26-2008, 03:40 AM   #47
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Quote:
Originally Posted by Elysia View Post
Just as a heads up, some debuggers (such as Visual Studio) will complain if you use uninitialized variables.
Actually, the debugger just catches the crash and identifies that it happend through an uninitialized variable - this is done by filling local stack-based variables with a pattern just like I described above, and when the data is being used as a pointer/index, it is detected as a "uninitialized data" error, rather than a random "got outside valid memory".

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 09-26-2008, 03:43 AM   #48
Mysterious C++ User
 
Elysia's Avatar
 
Join Date: Oct 2007
Posts: 14,785
If you want to put it that way, sure.
There are always several ways to catch uninitialized variables.
Having a debugger do it for you is nice, I think.

Oh and some compiler will warn you if you try to use an uninitialized variable. I'm guessing GCC does and I know VC++ does.
Remember always to put your compiler warnings to maximum!
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 09-26-2008, 03:45 AM   #49
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Quote:
Originally Posted by Elysia View Post
Oh and some compiler will warn you if you try to use an uninitialized variable. I'm guessing GCC does and I know VC++ does.
Remember always to put your compiler warnings to maximum!
gcc does as long as you use sufficient optimization to perform flow-graph-analyzis, which I believe happens at -O2 and above.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
List all system and program files tnbui Windows Programming 7 07-10-2009 02:43 AM
Doubt in concatenating contents of two text files in C program umaguptan C Programming 5 02-11-2008 01:36 AM
We Got _DEBUG Errors Tonto Windows Programming 5 12-22-2006 05:45 PM
Abnormal program termination Kayoss C++ Programming 3 05-16-2006 03:29 PM
abnormal program termination ProLin C++ Programming 2 01-20-2002 09:56 PM


All times are GMT -6. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22