Why C++ and not C? Are there some features of C++ not present in C required for Bitcoin to function as it does?

I can see that a similar question has been asked before but I am more curious as to the specific features of C++ meaning that it was chosen for for Bitcoin's codebase instead of C (under the very large assumption it wasn't written in C++ purely as Satoshi's favourite language).


1 Answer 1


Maybe yes or maybe not, that is, there is no specific reason sometimes for choosing the programming language (This in general) especially in open source projects the language depends a lot on who is part of the project.

Surely C ++ is a ubiquitous language nowadays, just think that java and python were born from this language. In my opinion, in first the choice of C ++ has been given a lot since the presentation of the idiom to objects, we say that C does not have the classes it is not possible to realize many techniques that are in the everyday reality for current programmers.

Then just think that in 2009 all these "Go" languages were not present.

So my definitive answer is: "I think that in the periods when bitcoin core was released and in the previous one in which C ++ was developed it was a reference language for object-oriented programming and it was probably better to use an object-oriented language for technical reasons. as hereditary polymorphism.

I believe that this code cannot be written in C above all the transactions look here in my fork where I'm studying bitcoin core Click me

This is just my thought, I may be wrong.

Sorry for my terrible English but I'm learning

  • 2
    Bitcoin Core hardly uses polymorphism. There are plenty of reasons to prefer C++ over C (such as avoiding manual memory management). Commented Mar 25, 2019 at 18:57
  • @PieterWuille feel free to adjust my answer Commented Mar 25, 2019 at 19:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.