string comparison
Lars T. Kyllingstad
public at kyllingen.NOSPAMnet
Mon Dec 20 11:50:45 PST 2010
On Mon, 20 Dec 2010 18:44:12 +0000, doubleagent wrote:
>> Are you 100% sure that you are running this version
>
> I have to be. There are no other versions of phobos on this box and
> 'which dmd' points to the correct binary.
>
>> dictionary[word.idup] = newId;
>
> That fixes it.
>
>> The 'word' array is mutable and reused by byLine() on each iteration.
>> By doing the above you use an immutable copy of it as the key instead.
>
> I REALLY don't understand this explanation. Why does the mutability of
> 'word' matter when the associative array 'dictionary' assigns keys by
> value...it's got to assign them by value, right? Otherwise we would
> only get one entry in 'dictionary' and the key would be constantly
> changing.
This could be related to bug 2954, for which a fix will be released in
the next version of DMD.
http://d.puremagic.com/issues/show_bug.cgi?id=2954
-Lars
More information about the Digitalmars-d-learn
mailing list