On Wed, May 06, 2009 at 08:54:00AM +0800, John Darrington wrote: > On Tue, May 05, 2009 at 07:51:37PM -0400, Jason Stover wrote: > > > interaction_variable_create creates this internal variable. But > > the only place it seems to be used is in interaction_case_data, and > > there, the only use it has is to compare its dict_index > > with that of another variable. For internal variables, the > > dict_index is merely a serial number, so comparing the dict_indexes is > > probably doing nothing more than comparing the variable pointers > > themselves. > > I need to compare these internal variables to other variables, > so what is the best way? > > To answer that question I have to ask what you mean by "compare" in > this context. In other words what are the `value semantics' for the > comparison.
Ideally, two variables are the same if the user thinks they are the same. I guess that means they are the same if they have the same name and dictionary. > If you just want to check if a pointer to a variable points to the > same variable as another, then "if (v1 == v2)" will do the job. > But I'm not sure if that's what you want. I was doing this, but stopped because of the following possibility: v1 and v2 have the same name and data stored inside, but v2 is a different address in memory, having been allocated later than v1. In that case, v1 and v2 should be regarded as being the same, but won't be via "if (v1 == v2)". _______________________________________________ pspp-dev mailing list [email protected] http://lists.gnu.org/mailman/listinfo/pspp-dev
