C programing language family

closed account (N8MNAqkS)
how different is C++ from C and C#.

I want to learn all of them eventually, because some game engines dont support one or the other and I want to experiment with a lot of different engines.
C is an imperative procedural language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal runtime support.

https://en.wikipedia.org/wiki/C_(programming_language)

C++ has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation.

https://en.wikipedia.org/wiki/C%2B%2B

C# is a general-purpose, multi-paradigm programming language encompassing strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines.

https://en.wikipedia.org/wiki/C_Sharp_(programming_language)

If you truly want to learn, and learn well, three different yet related computer languages don't have an actual life for at least the next decade. Learning to program games can be just as much of a life stealer.
C++ was built on top of C, and while the languages are evolving in different directions, compatibility with C continue to be an important feature of C++. This does not mean all C code will work if compiled in a C++ compiler but it is usually very easy to use a C library from C++.

When it comes to C# I don't think you should pay too much attention to the name. It's mostly marketing. It's a totally different language. Of course there are similarities but there are many other languages that have them too.
C# is closer to Java than C++, though one particular feature I like in C# is that you have to write "virtual" in the functions for polymorphism to be handled correctly, like C++. Java makes everything virtual.

I started using C# regularly a year or two ago. Any second language you learn is going to be easier than the first language you learn, because part of learning the first language was learning how to think like a programmer in the first place.

Usually, you don't need to completely learn a different language, often it's just a subset of it you need to be familiar with, so this won't take years of your life to figure out.
a brief and slightly tongue in cheek history of time.

C was first.
c++ was built from C, adding classes for object oriented coding. it has continued to grow and morph away from C style coding but you can still use about 95% of C syntax right in c++ as needed or link in c code directly to compile it all together.
Java was built from c++, to make it multi OS/system portable and to limit the programmer somewhat.
C# happened when microsoft was told to stop messing up java with windowisms, so they forked the language and morphed it into a new language.
so they all have a common ancestor in C.
the others all have a common ancestor in C++.
but c# and C++ are siblings that are similar in places but very different in other places.
if that helps.
closed account (N8MNAqkS)
Why don't they just make a compiler that reads all code. Or at least one that can read similar languages. Just make one compiler that can read c++ C and C#. Combine them in some way. Maybe I'm missing something but i dont see why that would not be possible.
Why don't they just make a compiler that reads all code. Or at least one that can read similar languages
The answer is competing design decisions.

Language A says the statement XYZ means that, while Language B says the statement XYZ means this. If that is incompatible with this, how does one unify them?

It's generally possible to write parts of your program in different languages.
Last edited on
How would the compiler tell the difference between your C++/C/C# code? When will one language stop and the other begin? Moreover, if I start mixing code together from different languages, how should it react? If I declare "decimal" from C# and then do something with it only possible in C++, how will it take C# protocols and simply implement them into C++ standards? The issue here is that computers don't think, they process. You might see something like "The Pig Flew" and recognize it, maybe even make several opinions on it. But a computer can't do anything you don't program it to. You can look at the code and perhaps see what the intended effect is and recognize how certain lines should be handled to properly mix C++/C#/C, but the compiler can't. And anyone who would make such a compiler would have to somehow overcome the fact that he can't separate where one language ends and another begins, but will also need to figure out how a million combinations of language intermixing should resolve! "It's good to have dreams, just make sure they're attainable." ~ All Might

If you use an IDE like Visual Studio, you can run any of these languages from one application, you simply have to tell it which language you're going to code in.
Topic archived. No new replies allowed.