DEV Community

Giri Kishore
Giri Kishore

Posted on

Will Golang replace C/C++?

Go was developed by a Google team in 2007 to combine the simplicity of Python syntax and semantics with the efficiency of C ++. Although it is not very functional, it is an advanced compiled multithreaded programming language with all the advantages for building distributed systems.

With the execution speed of Go being comparable with C and C++, will it replace these languages in the distinct future? What's your take on it? Please comment your thoughts.

Discussion (22)

Collapse
james_palermo_bc208e463e4 profile image
James Palermo

No. These discussions always overlook how deeply entrenched C/CPP is in like… stuff. Stuff as in cars, cable boxes, movie projectors, fighter jets, particle colliders… heck Python uses a ton of C under the hood and the internet runs on Nodejs, written in C, running on operating systems written in C. Accessed by browsers written in C. The world runs on it.

Yeah it’s got a lot of problems but when a language is so widely deployed the problems don’t surprise engineers. The capabilities and limitations of the language are known quantities. Sure Ryan Dhal can complain about C and switch to Rust for Deno, but If you’re coding a new missile guidance system do you wanna use a new language that is theoretically better and easier to use, or the one that you’ve spent 20 years getting REALLY good at using for guiding missiles?

I predict that C/CPP will be replaced by a new language around the same time QWERTY keyboards are replaced by a new layout.

Collapse
peter_brown_cc2f497ac1175 profile image
Peter Brown

Go will die long before C or C++. It is just another fad language. The real benefit of Go will be the features of the language that are adopted and improved upon by C or C++.

Collapse
tracker1 profile image
Michael J. Ryan

While I largely agree with the conclusion, I disagree on the reasoning. There were other OS languages before C and there will be others. Rust for example. That said C has 4 decades of entrenchment. Go fits higher up the stack. It's a good fit for business and proceed work, nowhere precision memory management or very tight system development is needed.

It could be used for some gnu tools or similar, but the overhead of the go runtime would add up to a lot of overhead in space used if they tried to replace all the gnu tools with it.

Collapse
peter_brown_cc2f497ac1175 profile image
Peter Brown

Rust will not displace C. Rust is just another vendor controlled language that will not stand the test of time. It's legacy will be how it influences C or C++. There is too much investment in C and too much inertia for it to fail. I agree with you in that Go is too expensive in its runtime but Rust will not last either. Better to learn the latest C standard then invest time with Rust.

Thread Thread
tracker1 profile image
Michael J. Ryan

What vendor is controlling Rust, exactly?

Thread Thread
peter_brown_cc2f497ac1175 profile image
Peter Brown

Mozilla. Although it is open-source and much coding is done volenteer, they are the muscle and pocketbook behind it.

Thread Thread
tracker1 profile image
Michael J. Ryan

Mozilla has let rust be spun off into it's own organization. That has backing from Amazon, Microsoft, Google, Mozilla and others... If those companies are all in agreement on a language, it's in pretty good standing.

Collapse
amardeepsaini profile image
amardeepsaini

No it won't fade out. Google is releasing new features with optimization of build. Many big organisations are migrating from Python, java to Golang.

Collapse
tracker1 profile image
Michael J. Ryan

I think it's more likely to replace Java. Especially i considering low level OS development where Go doesn't fit at all. Go may replace some higher level use in the longer term. I don't think there's any good UI sorry as of yet. Rust will probably displace a lot of C/C++ for new development at the systems level, and potentially higher in the stack.

Go is mostly seen in process systems, where it's been largely Java and C# the past couple decades.

Collapse
deepanshusuman profile image
Deepanshu Suman • Edited

From some of the golang developers from google said when it comes to 10000 lines of code of c/c++ its compile time is slow then as golang it is fast.

Collapse
pgirikishore profile image
Giri Kishore Author • Edited

I'm sorry, I didn't get you. You're saying Golang is faster or slower than C/C++?

Collapse
deepanshusuman profile image
Deepanshu Suman

in terms of what you are comparing or where you may use it.
c++ is lit bit faster in terms of execution but do not support concurrency

Thread Thread
grizzlysmit profile image
Francis Grizzly Smit

which C++ are you talking about C++20 has coroutines etc C++23 will build on that, as for threads in the old sense I've been using them since C++11

Thread Thread
deepanshusuman profile image
Deepanshu Suman

I never used c++ i have googled about it for concurrency then it showed that you have to import library.

Thread Thread
deepanshusuman profile image
Deepanshu Suman

i was thinking to use c++ for rest server and app backend server but after compile time, concurrency and library i left that and using golang

Thread Thread
grizzlysmit profile image
Francis Grizzly Smit

that would be the older C++, C++ is a continually moving target

Collapse
kapilsh profile image
Kapil Sharma
  1. Go IS a very functional language. functions are first class citizens in Go
  2. Go is not as efficient as C/C++. In certain contexts, it's faster than java but doesnt even beat java in most cases

I think Go is a great server-side language and it will shine for backend systems. It already is for that matter. I see it replacing java (may be) but when you say replace, you fail to appreciate the amount of inertia it takes to move years-old code from one language to another. I mean it takes people years to move versions of compilers leave alone languages.

So at the end, my answer is it depends. For newer code, I can see Go making inroads into the traditional java market but most people are not gonna re-write their enterprise code in another language. It's a massive investment of time and money. Secondly, Go is definitely not an alternative to C/C++. When you need pure performance, nothing comes close to C/C++ - except for may be Rust in recent years.

Collapse
anandml4u profile image
anand.m.l

That's something never gonna happen.I think Go is not much potential as Rust when it comes to replacing something related to C/C++ . By saying that C/C++ has an irreplaceable firm position .Which is unchallengebale by any of the languages.

But... Rust replacing some of the C++ stuff is gaining momentum .Believe it or not its such a great language.

Collapse
logicwonder profile image
Arun K V

Yes Go can certainly replace C/C++ in many core areas. Golang succeeded initially in the cloud native development and the focus is now moving towards system programming area. To begin, Golang enables embedding of C libraries and is capable of running natively in embedded devices. With builtin buffer overflow protection, automatic memory management, cross compilation to different architectures, Golang produces highly optimal binaries with minimal size. The support for architectures is growing everyday. See gist.github.com/asukakenji/f15ba7e...
With a shallow learning curve, the future generations of programmers would be attracted towards golang. And the cheap availability of standard microprocessor platforms would reduce a lot of development from scratch. However C/C++ would continue for reasons why the Cobol and mainframes continue to exist. Golang has the potential to be the no 1 language if you target efficiency and optimization at any level.

Collapse
karanpratapsingh profile image
Karan Pratap Singh

I don’t think it’s fair to compare Go with C++, it’s more like C++ vs Rust

Collapse
vineyrawat profile image
Viney Rawat

Ferrari can't replace Lamborghini

Collapse
grizzlysmit profile image
Francis Grizzly Smit

No Go sux, and it is bad at pulling in libaries from other languages