From 55df7f0002cd12a7e9e95ea38b83bdd73443af87 Mon Sep 17 00:00:00 2001 From: Ken Thompson Date: Tue, 23 Mar 2010 13:00:02 -0700 Subject: maps access to a missing key will return the "zero" value R=rsc CC=golang-dev http://codereview.appspot.com/700041 --- src/pkg/runtime/hashmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pkg/runtime/hashmap.c b/src/pkg/runtime/hashmap.c index 281601fbc..ccb5cfdb5 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="); -- cgit v1.2.3