Mail Archives: djgpp/1998/12/21/02:50:58
> -----Original Message-----
> From: Rosemary Sheppard [SMTP:rosi AT ulster DOT net]
> Sent: Monday, December 21, 1998 4:43 AM
> To: djgpp AT delorie DOT com
> Subject: Re: ? strange problem
>
> > Hi
> >
> > Could any one tell me what happend with the following code, why I
> > assign
> > "heap->size = 0", but result is not "heap->size = 0".
> > Is it bug of djgpp?
> > Thanks for your help
> >
> > Liang
> > Ming-Chung
> >
<code removed>
I cut-n-pasted the example code, added the necessary header files and added
the following main function:
int main( void )
{
Heap heap;
Heap_Construct((char *) &heap, 100, 0);
}
The program works wonderfully, printing "heap->size = 0" and exiting.
My guess would be that the problem lies in the function calling
Heap_Contruct or even earlier, causing the first argument (the pointer to
char) to contain garbage. A write to this address could probably be
responsible for the abnormal behaviour of the function.
Of course, the possibility exists that I am just lucky and you aren't ;).
Btw, just out of curiosity, why is the first pointer declared as char * and
not Heap *? :)
Regards
/ Z
---------------------------------------------------------------------------
Ztream / 1x4x9 - "The white dwarf"
ztream AT x3m DOT se \ www.highrad.x3m.se/Ztream
Free your mind.
- Raw text -