Mail Archives: djgpp/1999/10/05/14:34:59
On Mon, 04 Oct 1999 16:17:48 -0700, Nate Eldredge <neldredge AT hmc DOT edu>
wrote:
>Sune Nielsen wrote:
>>
>> Please don't rip my head off for posting this rather longish email,
>> but I seriously need help :(
>>
>> I've recently upgraded DJGPP from version 2.01 to 2.02, and now, for
>> some reason of which I have absolutely no idea, it compiles my code
>> into completely rubbish. Well... it actually compiles rather fine, but
>> when I try to run the program it tells me something like
>>
>> <snip>----------------------
>> Call frame traceback:
>> in function malloc+99
>> in function _flsbuf+76
>> etc...
>> <snip>---------------------
>>
>> I mean "malloc"... I donīt even use that function (itīs supposed to be
>> C++ ;)
>> Have I totally missed some point or... is my code really that buggy? I
>> am positive that it worked under v2.01!
>
>It's very likely to be a bug in your code. v2.02 introduced a new
>implementation of malloc (and C++'s `new' and `delete' are built on top
>of the `malloc' family) that happens to be much less tolerant of
>erroneous behavior like overrunning arrays and multiple freeing.
>
>Note that your traceback doesn't necessarily point to the buggy code;
>often something like an overrun will corrupt malloc's internal state and
>cause it to crash on a later, valid operation.
>
>Anyway, you should start hunting the bug. An automated malloc checking
>tool is often helpful in cases like these. I've written one called YAMD
>available from
>
>http://www3.hmc.edu/~neldredge/yamd/
>
>There are others on Simtelnet if you prefer.
I think somewhat you're right! And I tried to download your YAMD, but
it was way too complicated for me (hey, I'm a newbie:), so I tried
some serious debugging through RHIDE instead, and guess what...
when I altered this bit of code...
<code snip>
...
struct facet { facet *nextfacet;
vertex vertex_array[2];
^^^
...
<cut >
into
<code snip>
...
struct facet { facet *nextfacet;
vertex vertex_array[3];
^^^
...
<cut >
it all worked out :), but now Iīm more or less confused...
When I declare an array eg,
int array[3];
should I index it from 0 through 2 or should it be from 1 through 3,
or could it even be from 0 through 3!?
I know this is really basic C-stuff, but the Kris Jamsa book I use
apparently doesn't clearify this thoroughly (I'm confused anyway, 'cos
I though I understood it)...
Thanks for your help,
Sune Nielsen
sunegn AT image DOT dk
- Raw text -