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 | e781303e271cd2c062d7e834927210ad529e4d7d (patch) | |
| tree | db19eef1b66ce080c7548c2369e4bf7f89d602f6 /src/pkg/runtime/hashmap.c | |
| parent | 66caa38d495f223ebaf4bd4b411d8d7b492277cd (diff) | |
| download | go-e781303e271cd2c062d7e834927210ad529e4d7d.tar.xz | |
maps access to a missing key
will return the "zero" value
R=rsc
CC=golang-dev
https://golang.org/cl/700041
Diffstat (limited to 'src/pkg/runtime/hashmap.c')
| -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 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="); |
