by habibur · 3y ago · 0 comments
- I prefer functions over classes.
- no mangling of exported names, the binary is re-usable as API.
- in the long term, the C source code is more re-usable in other projects than C++ ones.
and more like this.
Then use functions?
> no mangling of exported names, the binary is re-usable as API.
Not once in my life have I seen someone use a binary as an API.
> in the long term, the C source code is more re-usable in other projects than C++ ones.
I don't even know what you mean by that.
He means that if you write your library in C it is callable from Python, Java, C++, Ruby, PHP, Python, Perl and more.
Because C++ without exceptions is not C++, and those languages cannot catch exceptions, nor call overloaded functions, nor delete or create objects using new and delete, nor refer to fields with classes, nor call methods on objects.
ps. you know you can write C++ code that is functional and use free functions primarily instead of putting everything in classes?
And once you fix it, you have built a light weight library that you can use from any other language.
Also these pointer manipulation is what gives C its power.
I also prefer apples over brooms.