Changes before 1.0

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Mon Dec 4 10:28:27 PST 2006


Leandro Lucarella wrote:
> Frits van Bommel escribió:
>> Some nitpicks :)
>>
>> Leandro Lucarella wrote:
<snip>
>>> problematic one, but could be done with something like:
>>> {
>>>     auto tmp = cursor.position;
>>>     cursor.position = cursor.position + 1;
>>
>> Surely you mean 'cursor.position = tmp + 1;'?
> 
> Well, they have the same value at that point, so what's the difference?

Sorry, I thought cursor.position was a property?
If so, the way you wrote it the getter would be called twice as opposed 
to once with the rewrite.
If the getter returned something else the second time[1] then the 
returned value wouldn't even be one less than the new value[2].

Plus accessing a local variable is probably more efficient than calling 
a getter :).


[1]: This is probably pretty bad style, but it _is_ legal.
[2]: Unless of course the setter did something weird as well, but let's 
not get into that.



More information about the Digitalmars-d mailing list