[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dict_var_resized

From: Jason Stover
Subject: Re: dict_var_resized
Date: Wed, 6 May 2009 07:54:34 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

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)".

reply via email to

[Prev in Thread] Current Thread [Next in Thread]