[DGD]Arrays and call others

mtaylor mtaylor at ntlworld.com
Sat Jun 23 04:23:47 CEST 2001


Ooo ... And I had one more question ...

Below is a snippet of of code I have for matching a name entered by a user
to an array of reference names within a room's contents. I'm just wondering

I have two ways to do it and I don't know which is more concise and better
for memory usage ...


(1) This is the way I am currently doing it.
          
for (i = 0, sz = sizeof(static_contents[i]->query_reference_names()); i <
sz; i++)
{
    if (static_contents[i]->query_reference_names()[ii] == name_test)
    {
        return static_contents[I];
    }              
}    

I'm a little worried that making call others each time will be eating up
memory. Would it be better to make one call other setting arrays in the
function: 

(2)

Rnames = current_object->query_reference_names();

for (i = 0, sz = sizeof(rnames); i < sz; i++)
{
    if (rnames[i] == name_test)
    {
        return current_object;
    }              
}    


Thanks for help in advance. Again apologies for any stupid questions ... I'm
a newbie/learner ... And enjoying it ;)

Matt 


List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list