map source codes

315 views
Skip to first unread message

sessetni

unread,
Aug 9, 2010, 10:59:22 PM8/9/10
to golang-nuts
Could you please tell me where I can find Maps|the map keyword source
codes? is it in compile source codes?
var timeZone = map[string] int { "UTC": 0*60*60, }

Andrew Gerrand

unread,
Aug 9, 2010, 11:04:34 PM8/9/10
to sessetni, golang-nuts

src/pkg/runtime/hashmap.c

sessetni

unread,
Aug 9, 2010, 11:23:29 PM8/9/10
to golang-nuts
I searched hashmap.c and couldn't find map as the search keyword. Is
hashmap.c the correct file?

In Directory src/pkg/runtime/, there are some files in C and some in
Go, why is that? why hashmap is not in Go?


On Aug 9, 11:04 pm, Andrew Gerrand <a...@golang.org> wrote:

Ostsol

unread,
Aug 10, 2010, 12:55:21 AM8/10/10
to golang-nuts
It seem to me that while the library is written (mostly) in Go, the
language is written in C. The "runtime" and "unsafe" packages have
been stated as being part of the language and therefore are largely
written in C. Similarily, the hashmap is a language feature and is
therefore written in C.

-Daniel

peterGo

unread,
Aug 10, 2010, 1:01:03 AM8/10/10
to golang-nuts
sessetni,

hashmap.h and hashmap.c are the files that implement maps at runtime.
Have you read them?

Peter
Reply all
Reply to author
Forward
0 new messages