]> Cypherpunks repositories - gostls13.git/commitdiff
maps access to a missing key
authorKen Thompson <ken@golang.org>
Tue, 23 Mar 2010 20:00:02 +0000 (13:00 -0700)
committerKen Thompson <ken@golang.org>
Tue, 23 Mar 2010 20:00:02 +0000 (13:00 -0700)
will return the "zero" value

R=rsc
CC=golang-dev
https://golang.org/cl/700041

src/pkg/runtime/hashmap.c

index 281601fbc767165467292611827a4ddf35e7859f..ccb5cfdb56d2ce992c805231161448b281613d96 100644 (file)
@@ -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=");