Mail Archives: djgpp/2001/10/01/07:19:01
Brian Smith <graywolf DOT smith AT virgin DOT net> wrote:
> I have a game prog I have written in C++ and ASM.
> It involves large graphics files and small 'spites like' objects. The
> graphic are constructed in a mem block set up by malloc. All changes (moves
> etc) are completed here then the whole file is copied to the vidoe memory.
> a 'newly complied' program runs fine but when it is run again, with
> compling, the 'sprite' positions are wrong (out of position).
This more probably than anything else means that you are using
uninitialized variables. The values from the first run are still in
the same memory positions when you run it again, and they're different
from those that the compiler, using the same memory, has left there.
> I have checked the 'FREE' command and this matches exactly the MALLOC
> allocations.
Memory leaks or other malloc()/free() usage errors are quite unlikely
to be the source of this problem. It looks more like your using
variable fields found in freshly malloc()ed memory blocks without
setting them to some definite value.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -