Isn't "transitive" the wrong word?

Manfred Nowak svv1999 at hotmail.com
Sat Apr 5 10:23:18 PDT 2008


Janice Caron wrote:

>>   if x is const
>>  and z is reachable from x
>>
>>  then
>>
>>     z is const
> 
> My apologies for being thick, but I still don't get it. What
> /exactly/ is the binary relation R, such that:
> 
> (1) (a R b) and (b R c) implies (a R c), is true in D
> (2) (a R b) and (b R c) implies (a R c), is false in C++
> 
> I still can't figure that out. Am I just missing something
> obvious? 

a R b
=(def)
if a is const and b is reachable from a
then b is const


Counter example in C++:

int* const pY;           // constant pointer to changeable int
*pY = 4;                 // legal - can use pY to modify an int
pY = &someOtherIntVar;   // illegal - can't make pY point anywhere else

[cited from: http://www.possibility.com/Cpp/const.html]

-manfred



More information about the Digitalmars-d mailing list