Go
文章平均质量分 64
趣趣
没有简介
展开
-
Go, cgo in windows
Windows 下配置cgo环境: [*] 安装go,将C:\Go\bin添加到Path环境变量中 [*] 安装mingw, 将[i][b]C:\MinGW\bin;C:\MinGW\msys\1.0\bin[/b][/i]添加到Path环境变量中,如果go build xx.go报“cc1.exe: sorry, unimplemented: 64-bit mode not comp...原创 2015-02-02 16:17:02 · 151 阅读 · 0 评论 -
在 Golang 中使用 C 代码
参考文献列表: [url]http://golang.org/cmd/cgo/[/url] cgo 使得在 Golang 中可以使用 C 代码。 Hello World 为了有一个较为直观的了解,我们来看一个简单的例子,创建文件 main.go: [code="python"]package main /* #include void sayHi() ...原创 2015-02-02 18:41:34 · 99 阅读 · 0 评论 -
golang缺陷
1.没有范型。 2.import不允许循环。 3.不支持自动类型转换。eg.int+int64不能编译通过。 4.没有枚举。 5.没有严格的继承机制。 6.标准集合类偏少。eg.没有set,没有有序的map。 7.html template很难用。 [b]golang是一门简单粗暴的语言。[/b]...2017-07-05 11:10:31 · 117 阅读 · 0 评论 -
Golang继承多态实现
思路: 1.结构体方法可以继承(也不是继承,父结构体的方法可以顺延下来)。 2.利用接口。 3.利用父结构体self变量,替换为真实使用的对象,调用的时候使用struct.self.Method调用接口中的方法。 [code="java"]func TestPolymorphic(t *testing.T) { child := &Child{Parent: &Parent{}} ...原创 2017-02-21 16:17:59 · 155 阅读 · 0 评论