1
0
mirror of https://github.com/golang/go synced 2024-11-25 09:57:57 -07:00

maps access to a missing key

will return the "zero" value

R=rsc
CC=golang-dev
https://golang.org/cl/700041
This commit is contained in:
Ken Thompson 2010-03-23 13:00:02 -07:00
parent 66caa38d49
commit e781303e27

View 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=");