[DGD]Arrays and call others
Par Winzell
zell at skotos.net
Sat Jun 23 04:58:44 CEST 2001
> 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;
> }
> }
In practice, the time consumed by the call-other itself is probably
not such a big deal. But it's typically a good idea to store return
values in a variable, yes, especially if you do not have absolute
control over what may happen inside query_reference_names() in the
future. Maybe somebody will change its internal implementation in
such a way that it becomes a backwards compatiblity function going
at some sluggish pace? I've seen it happen.
You can obfuscate your code quite a bit if you like it small:
if (sizeof(current_object->query_reference_names() &
({ name_test })) != 0) {
return current_object;
}
Zell
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list