Associative Arrays max length? 32bit/64bit
via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 17 02:26:30 PDT 2014
On Saturday, 17 May 2014 at 00:25:13 UTC, sdvcn wrote:
> import std.stdio;
>
> import std.utf;
> import std.uni;
> import std.string;
> import std.random;
> import std.conv;
>
> int main(string[] argv)
> {
>
> size_t[string] bary;
>
> try{
> for(size_t i=0;i<(size_t.max -1);i++)
> {
> bary["Key:" ~ to!(string)(i)] = i;
> }
> }catch(Exception e)
> {
> writeln(e);
> }
> return 0;
> }
> // This code will overflow?
>
>
> bary.length <> size_t.max ?
>
> 32bit bary.length == 64bit bary.length ?
I cannot get the 32bit version to run on my computer, but what
exactly is happening?
I suspect you will simply run out of memory at some point, but
this shouldn't be caught by catch(Exception), as it should throw
an Error.
Can you post the exact output of your program?
More information about the Digitalmars-d
mailing list