[Os-project-managers] Equal or equivalent?

Gus Gassmann Horand.Gassmann at dal.ca
Wed Jan 26 14:44:43 EST 2011


Hi guys,

As you know, I have been experimenting with randomly generated object 
instances (currently only OSOption objects), and I have found my first 
serious bug/feature.

Consider the two snippets from an osol file:

...
<variables>
    <initVariableValues numberOfVar="0"/>
</variables>
...

and

...
<variables>
</variables>
...

They are clearly different, although they are functionally equivalent. In the 
OSoLWriter I am checking for numberOf...="0" and suppressing the 
generation of the object in that case. (That is, when I read the first version 
and write the corresponding object, what I write is version 2.) 

Now, when I then try to test the two objects for equality, they are not equal. 
In the first object, ...variables->initVariableValues points to a real memory 
location, but in the second case it is a NULL pointer. 

The question is what I should do about it. Should I simply write the first 
version without compression, should I implement a more complicated test 
for equality, should we change the schema so that <initVariableValues> is 
only present when numberOfVar is strictly positive, should I do something 
else entirely? (What?)

Any thoughts?

Thanks

gus



More information about the Os-project-managers mailing list