TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Go for C++ Programmers

54 pointsby cyber1over 10 years ago

6 comments

Animatsover 10 years ago
From the article: <i>Go is &quot;safe&quot; by default. Pointers cannot point to arbitrary memory, and buffer overruns result in crashes, not security exploits.</i><p>That&#x27;s only true for single-thread Go. Go is not memory-safe in multithread mode, because exploits using race conditions are known.[1] This, incidentally, is why Go is locked down to one thread when running under Google&#x27;s AppEngine.<p>Go is a good language for server-side web work - all the expected libraries are there and in good shape. That makes sense; that&#x27;s why Google had Go created. Go is a good option when Python and Javascript&#x2F;node.js are too slow. But Go&#x27;s concurrency isn&#x27;t as clean as its enthusiasts claim.<p>I&#x27;d recommend Go for programmers coming from the Javascript&#x2F;Python&#x2F;Perl world. Although Go is a hard-compiled language, it&#x27;s surprisingly similar to the scripting languages when writing routine server-side code. C++ programmers will find Go easy, mainly because it&#x27;s garbage collected.<p>(The replacement for C++ will, if we&#x27;re lucky, be Rust. Rust has roughly the complexity level, headaches, and gotchas of C++, but it catches all the memory-related bugs at compile time. Rust isn&#x27;t ready for production use yet, though. Give it a year.)<p>[1] <a href="http://research.swtch.com/gorace" rel="nofollow">http:&#x2F;&#x2F;research.swtch.com&#x2F;gorace</a>
评论 #9011949 未加载
评论 #9011263 未加载
评论 #9011600 未加载
bltover 10 years ago
&gt; <i>Go provides automatic garbage collection of allocated memory. It is not necessary (or possible) to release memory explicitly. There is no need to worry about heap-allocated vs. stack-allocated storage, new vs. malloc, or delete vs. delete[] vs. free. There is no need to separately manage std::unique_ptr, std::shared_ptr, std::weak_ptr, std::auto_ptr, and ordinary, &quot;dumb&quot; pointers. Go&#x27;s run-time system handles all of that error-prone code on the programmer&#x27;s behalf.</i><p>This is not an attractive statement to C++ programmers like the author probably imagines it is. We like being in control of our memory. C++ programmers who would prefer to not manage memory have probably already switched to Java or C#.
评论 #9013415 未加载
评论 #9013414 未加载
ameliusover 10 years ago
So, when writing a high-performance, scalable web-server, which language should I pick: Go, C++, Rust, Scala, other?
评论 #9011348 未加载
评论 #9012227 未加载
评论 #9012301 未加载
评论 #9011640 未加载
评论 #9013349 未加载
评论 #9011530 未加载
评论 #9011336 未加载
评论 #9011500 未加载
评论 #9011309 未加载
vinkelhakeover 10 years ago
Go for C++ programmers, or.. trying to keep a straight face when explaining that no, just implementing &quot;Less&quot; to sort an array of some type isn&#x27;t enough. You&#x27;ll also need to tell Go how to get the length of an array and how to swap two elements.<p>Now, don&#x27;t get me wrong. I actually like Go for the things I use it for: replacing Python.
评论 #9011976 未加载
评论 #9011694 未加载
0xdeadbeefbabeover 10 years ago
And it also doesn&#x27;t encourage long compile times, so you might be tempted to do less thinking and more compiling.
GFK_of_xmaspastover 10 years ago
As a C++ programmer, if I wanted that kind of stuff why wouldn&#x27;t I switch to java.
评论 #9011720 未加载
评论 #9011567 未加载