Dynamic arrays allocation size

"Luís "Luís
Tue Mar 26 10:45:38 PDT 2013


On Tuesday, 26 March 2013 at 14:04:48 UTC, bearophile wrote:
> It's a unacceptable trap for a modern language:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=4835

I agree, but apparently, for what its worth, Java doesn't 
complain either:

class Test
{
     public static void main(String[] args)
     {
         long a = 3 * 1024 * 1024 * 1024;
         long b = 3 * 1024 * 1024 * 1024L;

         assert(a < 0);
         assert(b > 0);
     }
}

$ javac test.java
$ java Test
$ (no error)

On the other hand, if this is fixed (err, improved?) then you 
have one more reason to say that D is better than Java ;-)


More information about the Digitalmars-d mailing list