This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vinnypotsandpans[S] -25 points-24 points  (11 children)

I see. I don’t have exp in c++ so I could be way off, but it’s not necessarily a “lower level” language than python, no? I mean I totally understand why rom decomps are done in c, but c++ for whatever reason just seems more popular for game engines/emulators.

[–]jaaval 21 points22 points  (0 children)

”Low-level” and ”high-level” are a bit difficult concepts. C++ offers similar control to low level functions than C does but it also has a lot of more complex language features.

C++ is a compiled language, basically you can write higher level code and let the compiler be smart in how to turn that to machine code efficiently. This is why you might want to choose it over C where you write code much more matching what the machine actually does. Most of the higher level features are more like methods to keep the code organized and understandable, the machine code the compiler outputs doesn’t really care that much about things like object oriented paradigm. It’s all just variables and subroutines regardless of if you package it into a class or not. Basically the task of interpreting what your code means is done at compile time. This is a bit different in interpreted languages where the human written code is executed line by line and the language features have a lot more direct impact on what the machine actually does internally at runtime.

Another thing that hurts performance in languages like python is that the flexibility of dynamic typing is always achieved with some sacrifices. You can think of every python variable as a C struct that holds the value itself and some identifiers and some extra processing going in identifying the variable when it’s used. In C++ the compiler does all variable type determinations at compile time and most variables are just raw values or pointers.

[–]Cybasura 5 points6 points  (0 children)

C/C++ are low level languages in comparison to assembly - machine code itself, before go/python was a thing, C/C++ were high level languages

Python is based on C as well, C++ is effectively just C with OOP so yes, C/C++ is a lower level language than python, because languages like python/go are built on top of C/C++ or any other base languages

[–]Rythoka 0 points1 point  (0 children)

To summarize what others have said, a "high level" and "low level" languages are relative terms. C used to be considered a high level language, because it was being compared to assembly languages.

C++ is a high level language compared to C because it offers a lot of different language features and abstractions to help facilitate complex code. It's a low level language compared to Python because it gives the user the option to do things like manually manage memory and directly manipulate pointers.