2 ms·
> I prefer functions over classes. Then use functions? > no mangling of exported names, the binary is re-usable as API. Not once in my life have I seen someo
by uxp8u61q 3y ago
> I prefer functions over classes.
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.
- lelanthran 3y ago> 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.
- uxp8u61q 3y agoYou can also do that with C++.
- lelanthran 3y agoNo, you cannot. 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.
- uxp8u61q 3y ago> Because C++ without exceptions is not C++ Write exception-free external APIs. It's not that hard. > call overloaded functions Write an API that doesn't overload functions? > nor delete or create objects using new and delete Write an API around that. You'd need to do it in C anyway. > nor refer to fields with classes What? > call methods on objects If you can call a function, you can call a method. Your complaint is basically "you cannot write C++ in Python". Duh.
- lelanthran 3y ago> Your complaint is basically "you cannot write C++ in Python". Duh. Maybe it is a complaint, but it's still a fact of life: your code is not reusable without wrapping it in C. The reality is that C++ is not as reusable as C is: ever wonder why there are so few reused libraries written in C++, while they are so many in C? Look on your system now - it's filled with C libraries, while the C++ libraries are probably a rounding error.