diff options
author | Ken Thompson <ken@golang.org> | 2010-03-23 13:00:02 -0700 |
---|---|---|
committer | Ken Thompson <ken@golang.org> | 2010-03-23 13:00:02 -0700 |
commit | 55df7f0002cd12a7e9e95ea38b83bdd73443af87 (patch) | |
tree | e07e584cebf5794c6d2fe3671068251cd0da651d /src | |
parent | 3515ef9d3b3cc90214cb2fe8e4df55c9d775a8f5 (diff) | |
download | golang-55df7f0002cd12a7e9e95ea38b83bdd73443af87.tar.gz |
maps access to a missing key
will return the "zero" value
R=rsc
CC=golang-dev
http://codereview.appspot.com/700041
Diffstat (limited to 'src')
-rw-r--r-- | src/pkg/runtime/hashmap.c | 6 |
1 files changed, 4 insertions, 2 deletions
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="); |