What is a "modern" programming language?

What language should I use as an alternative to C/C++ for systems programming?

  • I'm very interested in programming design and development. I love learning new esoteric languages and seeing what cool new features they have. After seeing so many cool languages, I've come to realize how bad C++ is. It's really just an attempt to turn C into a modern programming language, and it's a horrible attempt at that. There are a couple languages I've seen online that compete with C/C++ in the systems programming industry. This is systems programming, so speed and low level APIs are required, so languages like Java and Python are out (even though I love both). I'm talking about languages like Nimrod (http://nimrod-lang.org/), Rust (http://www.rust-lang.org/), and Go (I'm very impressed by Rust and Nimrod, and not so much by Go after using it for a bit). From personal experience, which language do you think is the best alternative to C/C++? Feel free to comment on the ones already mentioned.

  • Answer:

    I'm surprised people are recommending assembly, when in the question details it sounds like you are asking about modern systems languages. Assembly is the exact wrong direction to go in this case. If Rust is to your taste, you might also like http://dlang.org/. Or perhaps http://en.wikipedia.org/wiki/Cyclone_(programming_language). I'm by no means an expert on these things, but I tend to think that Rust will be the best option once the ecosystem has matured more.

Dylan Hirshkowitz at Quora Visit the source

Was this solution helpful to you?

Other answers

You have no idea how powerful and convenient C++ is I would advise learning it better before you dismiss it offhand based on internet lore. As of today there are only a couple of decent alternatives to C++ in the systems world : D - It does everything C++ does and then some more Delphi - If you develop for Windows, this is amazing C# - Ditto Rust and the rest are new kids on the block and they are only mildly better than raw C for systems work.  By systems, I mean writing programs who mainly call OS functions, deal with low level APIs like OpenGL, DirectX with explicit multithreading, native GUIs and so forth.

Vivek Nagarajan

If you care about performance and low-level, I don't think there's any alternative, provided that we don't want to go in the direction of assembly code. Rust is probably the closest, but it doesn't run as fast as C++. http://benchmarksgame.alioth.debian.org/u32/rust.php D is another alternative, but its performance is also worse. The problem is its garbage collector. For systems programming that does not involve much memory, you'll find similar performance in C++ and D, but once it involves memory management, all languages using GC are out of the game. Memory management is crucial for high-performance systems programming. Sometimes we have to bypass C++ STL and directly manipulate pointers for performance-critical code. Obviously when you deal with low-level pointer manipulation, you have to be very careful. Which part of C++ you do you not like? If it's pointer manipulation, you can follow certain principles and/or use shared_ptr, unique_ptr, weak_ptr, ...  If you still don't like that, then you have to sacrifice performance for built-in-language memory management.

Zhao Wu

In my point of view, assembly is the best alternative to C. Assembly takes you more lower and lower, and lets you know more details. As an entry-point to assembly language, you can try writing a boot-loader on an 8086 PC, or you can write some assembly programs for GNU/Linux on i386 <$ man -s 2 syscalls is your start>. EDIT: I'm surprised at the amount of people that try to convince other people that Assembly is wrong for them. IMO it is really worth to learn asm. I don't know about your orientations or whether you know assembly or not. Let's assume you never knew assembly... In this case, you have missed a lot of interesting challenges, like: Hacking into Linux kernel and understanding how the kernel parts that are written in assembly work. Writing your own OS. Writing you own compiler, linker, loader, assembler, and debugger. Writing you own firmware. Writing you own device drivers for your own OS! I really find assembly very important in real life. Assembly has a lot of applications that help systems programmers in many areas, like real-time systems and low-level embedded systems. Now assuming that assembly is bad... and people shouldn't learn assembly because it is old (as some people claim), what is the result? You will never understand how the code that you write in C <or any language> is compiled and translated into machine language. You will never know what machine language is! You will never know how software and hardware co-operate together. You think that you are a low-level guy, while in fact, you will find that you know very little about the lower levels, because you've missed assembly (this is just a point of view). IMPORTANT NOTE: I am not against other languages. I suggest that you try learning as many languages as you can (but not too many). YET ANOTHER IMPORTANT NOTE: When we recommend learning assembly, we mean: "try to train yourself by writing some interesting projects in assembly"... and not "just read about assembly and know about its structures and expressions". Assembly language doesn't have standard structures and expressions. Every ISA has its own instruction mnemonics and registers. And every assembler has its own format and directives. I suggest that you start with 8086 (or 80386) with GNU Assembler. This is systems programming, so speed and low level APIs are required If you really appreciate low level APIs, then assembly is the right direction for you.

Mostafa Abd El-Aziz

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.