[DGD] Uninitialized variable error

Michael McKiel crashnbrn71 at yahoo.ca
Fri Mar 26 09:38:12 CET 2004


I'm wracking my brain trying to figure this one out, I'm not sure if anyone
can help or not - but this situation is making absolutely no sense to me.

I have a file, inherit/secure/alias.c that is inherited by my user object and
which is initialized whenever a new user object is cloned.

create()
{
    aliasd = find_object(ALIASD);
    helpd  = find_object(HELPD);
    aliases = ([ ]);
    history = ({ });
    DRIVER->message("Initializing alias.\n");
}

string process_alias(string str)
{
    return aliasd->process_alias(this_object(), str);
}

string *history(varargs string cmd)
{
    if (!cmd) {
        if (previous_program() != CMD_HISTORY) 
            return nil;
        return history[..];
    }

    if (previous_program() != ALIASD) return nil;

    if (!history) {
        DRIVER->message("history: wtf?? !history.\n");
        history = ({ });
        return nil;
    }
}


The aliasd uses the object sent to it's process_alias() to call into that
object's aliases & history. (variables inherited in alias.c)

    string process_alias(object who, string str)
    {
        <snip code>
        who->history(str);
        <snip code>
    }


in the user object's do_command() there is a call to process_alias(str);
which calls aliasd's process_alias() which at one point calls back into the
user's history() function.


So whenever a new user object is cloned my driver output shows
    "Initializing alias."
The first command that any user issues, when history() is called causes:
    "history: wtf?? !history."  in the driver output.
Any subsequent commands do not cause that message to appear.
I do not understand how this is possible. 
Why does the history variable needs to be initialized again?


Hopefully this is enough info to follow what's going on, and perhaps point
out something I'm missing, because I'm thoroughly stumped.



______________________________________________________________________ 
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