Re: [CODE] Autodiag totally confused now

From: Chris Hyde (slugger@CRYOGEN.FERRIS.EDU)
Date: 04/03/98

> Now i am totally confused I put this into  perform_violence:
> struct char_data *victim;
> to this
> if (PRF_FLAGGED(ch, PRF_AUTODIAG) && !IS_NPC(ch) && GET_HIT(victim) < 0)
>    send_to_char("\r\n", ch);
>    diag_char_to_char(FIGHTING(ch), ch);
> When i complie i get 'victim' may be an uninitilized in this function
> but it continues to compile.

You need to at set the pointer equal to something(initialize it).  Even if
that is nothing more than a statement like this:
        *victim = '\0';
I believe that without initialiation, the pointer will grab some chunk of
memory that may already contain something and try to use that...
I have had that error before in other things I was doing, and this is what
worked for me. =)

Llewelyn of Erendor

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST