Re: std.complex

2010-05-08 Thread Robert Clipsham
On 09/05/10 02:27, eles wrote: Hello, I just installed dmd 2.045 (unarchived in c:\dmd2) and put c: \dmd2\windows2\bin on path. Compiling the following: import std.complex; int main(){ return 0; } fails with: C:\dmd2>dmd test.d OPTLINK (R) for Win32 Release 8.00.2 Copyright (C)

std.complex

2010-05-08 Thread eles
Hello, I just installed dmd 2.045 (unarchived in c:\dmd2) and put c: \dmd2\windows2\bin on path. Compiling the following: import std.complex; int main(){ return 0; } fails with: C:\dmd2>dmd test.d OPTLINK (R) for Win32 Release 8.00.2 Copyright (C) Digital Mars 1989-2009 All rights

Re: Example in the overview

2010-05-08 Thread bearophile
D2 code, the 8191 too is counted: import std.stdio: writeln; int sieve(int m) { auto isPrime = new bool[m + 1]; isPrime[] = true; int count; foreach (i; 2 .. isPrime.length) { if (isPrime[i]) { count++; for (int k = i * 2; k < isPrime.length; k +=

Re: Generic container

2010-05-08 Thread bearophile
wrzosk: > Object[string] foo; > foo["aaa"] = new AAA(); In D there is no the automatic boxing present in C#, so that can contain any object, but not any value. If you want to store any value, you need the values of that associative array to be of some kind of Box or Variant, etc. There are vari

Example in the overview

2010-05-08 Thread R.Tenton
At the very bottom of http://digitalmars.com/d/2.0/overview.html there is an example implementation of the Eratosthenes' sieve. That code is broken! It counts 1899 prime numbers, while there are only 1028 primes in the interval [1,8191]! What is the outermost for loop good for? This example is just

Re: Generic container

2010-05-08 Thread wrzosk
On 08.05.2010 23:52, lurker wrote: Hello, first time visiting the newsgroup. I see in the manual that you can create built-in dictionaries like so: int[string] foo; Do you know of a way to store any value in a dictionary? In C# I can do something like this: Dictionary foo; I need a dictiona

Generic container

2010-05-08 Thread lurker
Hello, first time visiting the newsgroup. I see in the manual that you can create built-in dictionaries like so: int[string] foo; Do you know of a way to store any value in a dictionary? In C# I can do something like this: Dictionary foo; I need a dictionary that can store any value, indexed b

Re: if(bool = x) does not give a boolean result

2010-05-08 Thread BCS
Hello Steven, No. I meant bool = bool. I'm not comparing two bools, I'm assigning to a bool, and then using if on the result. At best, this is a bogus error message. More often than not (or so the thinking goes), that isn't the case and the programmer in fact did want ==. Also, you mi