| www.delorie.com/archives/browse.cgi | search |
| From: | "John Spence" <jspence AT lynx DOT net DOT au> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: tracking down runtime error |
| Date: | Wed, 19 Aug 1998 12:30:42 +0930 |
| Organization: | Telstra Internet Browse Server |
| Lines: | 27 |
| Message-ID: | <35db3c4e.1490948@l> |
| References: | <35dab9f3 DOT 3381119 AT l> |
| NNTP-Posting-Host: | 203.33.18.75 |
| Mime-Version: | 1.0 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Well most of you were right and my pride blinded me to the problem :-)
I had malloc'd memory for the list nodes according to the
sizeof(Pointer_to_struct) instead of sizeof(structure_node)
The strange thing is that Linux-gcc let me do this and it worked. I
was suspicious of the DJGPP/gcc compiler but I think now that the
behaviour of the DJGPP compiler was correct.
Thanks to all who responded and I think I'll get a copy of Lint.
>Using the following code to display the contents of a linked list with
>DJGPP (gcc2721b)
>
>void traverse(NODEPTR start)
>{
> while(start)
> {
> printf("%d\n", start->number);
> start = start->next;
> }
>}
>
>I get the error which follows during runtime. I can run this program
>without a problem under Linux with gcc and DOS with Turbo C so I am
>99% confident that this is not a problem with my code.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |