[DGD] Uninitialized variable error

Michael McKiel crashnbrn71 at yahoo.ca
Fri Mar 26 14:16:15 CET 2004


 --- "Felix A. Croes" <felix at dworkin.nl> wrote: > Michael McKiel
<crashnbrn71 at yahoo.ca> wrote:
> 
> > Well sorry for spamming, which looks like me mostly talking to myself
> heh.
> > But the above didn't work, the process_alias() in aliasd, had a security
> > check of: if (previous_program() != LIB_ALIAS) return nil;
> > so it never actually got to the call to history().
> >
> > What did work, was making these 2 variables private: 
> >     mapping aliases;
> >     string *history;
> 
> Perhaps you are doing something to reset these variables to nil, such as
> performing a restore_object() in an object that inherits this code, with
> a save file that does not contain values for aliases and history?  In
> that case, just making these variables static should suffice.
> 
> Regards,
> Dworkin

Ah thats a side effect that I was unaware of, and yes that is exactly it,
aliases/history were added recently, and old savefiles don't have any.

I guess the kfun doc for restore_object could be furthered a bit:
adding "(or nil)" ? :)

NAME
        restore_object - restore variables of an object
SYNOPSIS
        int restore_object(string file)
DESCRIPTION
    Restore all global variables in an object that are not private or
    static from a file.  All variables which qualify, but were not
    restored and do not contain object values, will be set to 0 (or nil).
    1 is returned if the variables could be restored, 0 otherwise.


Course I never would of thought to look there, thanks.


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list