windows64/linux64 Error: cannot implicitly convert expression of type ulong to int

Steven Schveighoffer schveiguy at yahoo.com
Mon Feb 18 20:01:18 PST 2013


On Mon, 18 Feb 2013 22:13:14 -0500, Anastasios Tsiolakidis  
<abstractius at yahoo.co.uk> wrote:

> Hello,
>
> this is perhaps something for d.learning, except that I don't see how! I  
> found a small D program on Facebook http://pastebin.ca/2315433 , and  
> compiling it with all 3 implementations on my Ubuntu 12.10 gives this  
> "common" eror, in 2 implementations with more verbose output
>
>
> h3.d(72): Error: cannot implicitly convert expression (g0.length) of  
> type ulong to int
>
>
> On Windows 7-64 however it compiles just fine with dmd2. From a  
> discussion on this list I concluded this error is "fundamental" and  
> don't expect it to be configurable with a compiler switch or whatever.  
> Nor do I expect the dmd package to ship with fundamentally different  
> config files on windows and linux. What's going on?
> Thanks

Make sure the linux compiler you are using is 64 bit.

Just because you are on a 64 bit system doesn't mean you are compiling  
64-bit programs.  For example, in the latest dmd, there is a linux/bin32  
and linux/bin64 directory.  *BOTH* will run on 64-bit linux, but only the  
64 bit compiler will compile 64-bit programs.

That being said, as others have pointed out, the code really should use  
size_t and not int/uint.

-Steve


More information about the Digitalmars-d mailing list