问题描述
我是一名Web开发人员,希望扩展自己的视野,以便更好地整体编程。我已经做了一些Java和一些简单的Android应用程序。我现在正在研究像C和Go这样的低级语言(到目前为止,我必须说有一些漂亮的语法和很棒的想法,尽管我可能没有经验来评论)。
所以,我一直在努力理解
有趣的是,没有指针运算为什么没有指针运算?
安全。如果没有指针运算
,可以创建一个语言
,永远不会导致错误地成功的非法
地址。
编译器和硬件技术具有
的先进性,使用数组索引的循环
可以像使用指针
算术的循环一样高效
。另外,缺少指针
算术可以简化垃圾
收集器的
实现。
现在我想开始学习GO!
I'm a web developer looking to expand my horizons in order to get better at programming as a whole. I've done a bit Java and some simple Android applications. I'm now looking into lower level languages like C and Go (which I must say has some beautiful syntax and great ideas thus far, though I'm maybe too inexperienced to comment).
So yeah I've been going though and trying to understand the examples on the Go website and I keep coming across a special asterisk character in example like this:
s := "hello" if s[1] != 'e' { os.Exit(1) } s = "good bye" var p *string = &s *p = "ciao"
Also, I just noticed, whats with the "&s" is it assignment by reference (I might be using PHP talk here)?
Im guessing it means the same as in C
p is a pointer to a string
The statement var p *string = &s would assign the address of the s object to p
Next line *p = "ciao" would change the contents of s
See this link from the Language Design FAQ
Interestingly, no pointer arithmetic
Now I want to start learning GO!
这篇关于星号在“Go”中做了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!