dmd 2.029 release

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Apr 22 11:12:16 PDT 2009


Steven Schveighoffer wrote:
> On Wed, 22 Apr 2009 13:49:18 -0400, Andrei Alexandrescu 
> <SeeWebsiteForEmail at erdani.org> wrote:
> 
>> tama wrote:
>>> On Mon, 20 Apr 2009 16:09:09 +0900, Walter Bright
>>> <newshound1 at digitalmars.com> wrote:
>>>
>>>>
>>>> This is a major revision to Phobos, including Andrei's revolutionary
>>>> new range support.
>>>>
>>>> http://www.digitalmars.com/d/2.0/changelog.html
>>>> http://ftp.digitalmars.com/dmd.2.029.zip
>>>
>>> Range is so cool!
>>>
>>> Though...
>>> I tried following code:
>>>
>>> void main()
>>> {
>>>     writeln("Case1");
>>>     {
>>>         Mt19937 gen = Mt19937(0);
>>>         writeln(gen.front);
>>>         gen.popFront;
>>>         writeln(gen.front);
>>>     }
>>>     writeln("---");
>>>     {
>>>         Mt19937 gen = Mt19937(0);
>>>         advance(gen, 1);  // skip 1 element
>>>         writeln(gen.front);
>>>         gen.popFront;
>>>         writeln(gen.front);
>>>     }
>>>     writeln("\nCase2");
>>>     {
>>>         Mt19937 gen;
>>>         writeln(gen.front);
>>>         gen.popFront;
>>>         writeln(gen.front);
>>>     }
>>>     writeln("---");
>>>     {
>>>         Mt19937 gen;
>>>         advance(gen, 1);  // skip 1 element
>>>         writeln(gen.front);
>>>         gen.popFront;
>>>         writeln(gen.front);
>>>     }
>>> }
>>>
>>> Result:
>>>
>>> Case1
>>> 2357136044 (1)
>>> 2546248239 (2)
>>> ---
>>> 2546248239 (2)
>>> 3071714933 (3)
>>>
>>> Case2
>>> 581869302  (1)
>>> 3890346734 (2)
>>> ---
>>> 581869302  (1)?
>>> 3890346734 (2)?
>>>
>>> I think 'Case1' is correct, but 'Case2' is wrong.
>>> Mt19937's bug?
>>>
>>
>> If you initialize the Mersenne twister with no seed it will start with
>> seed 5489u.
> 
> I think his point is in the second part of Case2, he skipped one 
> element, but it appears that it didn't skip anything.

Oh ok, thanks tama and Steve. I know where the problem is (on the 
Mersenne twister, if you call popFront without ever calling head there's 
a bug). Could you submit a bug? I'm on battery and on short time, and 
Walter is bugging me :o).


Andrei


More information about the Digitalmars-d-announce mailing list