Rockbox Development > Starting Development and Compiling

Why C?

<< < (4/7) > >>

bascule:

--- Quote from: zajacattack on December 04, 2007, 10:25:52 AM ---
--- Quote ---C++ is not a good choice simply because several of us who started Rockbox just don't like C++
--- End quote ---
Well, I was curious to whether there was an actual reason other than "not liking" C++.

--- End quote ---

Well, yes there was:


--- Quote from: Bagder on December 04, 2007, 04:21:12 AM ---...and the fact that lots and lots of the 3rd party libs we use are plain C and we use them as unmodified as possible.
--- End quote ---

FYI, some (performance-critical) parts of Rockbox are written in assembly. Now that's a proper programming language, none of these silly abstractions and high-level functions... ;)

GodEater:
As well, a lot of C++ features require dynamically allocated memory - which of course Rockbox :

a) Doesn't do.
and
b) Will never do.

zajacattack:
OK, I see now. So, C++ is better for high-power computers, but not efficient enough for MP3 players, right? Also, I know some is written in assembly, as that is the most efficient code (exact control over processor, smallest executables, etc.). And, I read about the dynamic allocation of memory. So, I'm curious, why will rockbox never do that?

AlexP:
http://www.rockbox.org/twiki/bin/view/Main/WebHome?topic=WhyNoMalloc

mnhnhyouh:
In line with the assembly comments above, programming languages are just a convenient way of writing assembly, just more abstraction, so less lines to write and this makes complex code easier to understand for most programmers.

The compiler then turns the code written in other languages into the actual instructions that the cpu executes.

So in an ideal world C, C++, Java and all the other compilers would produce the same executable code. However this is not always the case....

h

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version