[Top][All Lists]

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

Re: dict_var_resized

From: John Darrington
Subject: Re: dict_var_resized
Date: Wed, 6 May 2009 20:30:42 +0800
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, May 06, 2009 at 07:54:34AM -0400, Jason Stover wrote:
     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, 
     >      > 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.

That seems like a reasonable definition.  But as you found out, it's
not going to work with "internal" variables, since they're rather
peculiar things.
     > 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)".

That shouldn't normally be possible.  The code in variable.c should prevent
there ever existing two variables with the same name and dictionary.
The only situation where I can envisage this happening would be if one
of the variables is deleted and another subsequently created with it's name.


PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature

reply via email to

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