Mail Archives: djgpp/1996/09/16/09:48:05
> From: kagel AT quasar DOT bloomberg DOT com
>
> Static and global variables are not initialized or zero'd unless explicitly
> initialized in the code. You have just been lucky because UNIX zeros the
> memory pages it assigns to a process so the garbage you have been getting just
> happened to be the zeros you wanted. DOS does not zero memory nor does the
> DPMI spec require this (IMHO) so DJGPP does not zero uninitialized memory.
ANSI requires unitialized static and global variables to be zeroed. So its nothing
wrong in not initializing static and global variables.
It happened to me to meet a very old unix system in which bss was not zeroed.
That fact caused me to spend some time in debugging until I found that out...
As to the problem being discussed, it can be caused not by a bug in djgpp, but
a bug in gdb. It can just show wrong region of memory. And, of course, it can
be caused by a bug in the program itself, say, by overrun array.
- Raw text -