From: Ken Thompson Date: Tue, 23 Mar 2010 20:00:02 +0000 (-0700) Subject: maps access to a missing key X-Git-Tag: weekly.2010-03-30~85 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e781303e271cd2c062d7e834927210ad529e4d7d;p=gostls13.git maps access to a missing key will return the "zero" value R=rsc CC=golang-dev https://golang.org/cl/700041 --- diff --git a/src/pkg/runtime/hashmap.c b/src/pkg/runtime/hashmap.c index 281601fbc7..ccb5cfdb56 100644 --- a/src/pkg/runtime/hashmap.c +++ b/src/pkg/runtime/hashmap.c @@ -769,8 +769,10 @@ void av = (byte*)&h + h->vo1; mapaccess(h, ak, av, &pres); - if(!pres) - throw("runtime.mapaccess1: key not in map"); + +// new spec -- all elements have "zero" value +// if(!pres) +// throw("runtime.mapaccess1: key not in map"); if(debug) { prints("runtime.mapaccess1: map=");