cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/16/01:39:18

From: nikki AT gameboutique DOT co (nikki)
Newsgroups: comp.os.msdos.djgpp
Subject: boo hoo. my code crashes.
Date: 15 Feb 1997 22:26:31 GMT
Organization: GameBoutique Ltd.
Lines: 44
Message-ID: <5e5d6n$fda@flex.uunet.pipex.com>
NNTP-Posting-Host: www.gameboutique.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

ok i give up, i have no idea what is wrong with the below code. it compiles
fine on sunos and linux but when i compile it with djgpp it gets to testpoint
'a' and then hangs. ie the initialising of the struct seems to be hanging the
machine. it never gets as far as printing 'b' :(

can anyone see what i've done wrong here? i'm out of ideas :(
(it's not something to do with the _packed_ attribute is it perchance?)

regards,
nik

---

struct node {
        unsigned int frequency;
        struct node *next;                    /* used to create an ordered list 
        struct node *zero_child, *one_child;
        unsigned short symbol;
        char *code;                           /* a string of 0's and 1's */
};

int huffman_encode ()
{
        struct node *histogram[NUM_SYMBOL_VALUES];
        struct node *huffman_tree;
        int encoded_stream_length;
        unsigned int i;
printf("a\n");
        /* initialize histogram */
        for (i=0; i<NUM_SYMBOL_VALUES; i++) histogram[i]= (struct node *) NULL;
printf("b\n");
}


(num_symbol_values is #define'd as 0x10000)
the program prints 'a' then hangs. even ctrl-c won't abort and i have to
reboot ;(
under linux and sunos this compiles and runs just fine.



-- 
Graham Tootell           
nikki AT gameboutique DOT com  

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019