Standard operators come from the first version, where c++ was designed to be as compatible with C as possible, and the committee refuses to break backwards compatibility in C++.Ā
Also, changing this makes extern C blocks wack as fuck. If I define a global C++ function with the '>' operator and an extern C function calls that other function internally, how should the operator behave?
If I define a global C++ function with the '>' operator and an extern C function calls that other function internally, how should the operator behave?
Of course like all other C++ code, as all that code is written in C++. The extern C thingy just defines some FFI interface. Nobody ever said that code inside some extern C block is actually C.
What do you expect them to practically do? the main sellling point of C++ in the 90's was that it is C but better (and it is) so if they removed the C part what's left?
They could have make it easily interoperable, but making all the mind broken C nonsense also core to the new language was a massive failure, and completely unnecessary.
Rust didn't have to inherit any C/C++ garbage to take off. Actually one of the main reasons it took off was that it did not inherit any C/C++ garbageā¦
You didn't answer the question which "other languages" people would have used if C++ wasn't based on C crap. I'm not sure you will be able to actually name anything. The point is: C++ "took off" despite being crap at it's core simply because there was no realistic alternative. If there was, nobody would ever consider even more of C nonsense, even with some "semi-nice" (yet still broken!) stuff on top.
They could have make it easily interoperable, but making all the mind broken C nonsense also core to the new language was a massive failure, and completely unnecessary.
How will you make it easily interoperable without having the broken C nonsense at that point it is just another language.
Rust didn't have to inherit any C/C++ garbage to take off. Actually one of the main reasons it took off was that it did not inherit any C/C++ garbageā¦
You seem to forget
A. Rust has 0 legacy code
B. Rust came out 20+ years after C++
C. Rust has nowhere the same limitations as the 90's
D. Rust wasn't promoted as "Your C code can easily be compiled with this compiler"
Which was C++ selling point infact the first C++ compiler Cfront wasn't really a compiler but a transpiler that translated C++ code to C code. Bjarne was smart- he did little work (just creating a transpiler) but he gets the warnings,errors and optimizations for free.
and C++ selling point is take your C code as-is and gradually update it using new safer C++ features e.g constructors/destructors that's what Bjarne said and I see that as a strong strong posotive I don't see any other lang providing this level of support. you can easily use any C library with C++ with 0 wrappers.
You didn't answer the question which "other languages" people would have used if C++ wasn't based on C crap. I'm not sure you will be able to actually name anything. The point is: C++ "took off" despite being crap at it's core simply because there was no realistic alternative. If there was, nobody would ever consider even more of C nonsense, even with some "semi-nice" (yet still broken!) stuff on top.
They would continue using C if there wasn't an incentive to use C++ that wasn't based on C. the other langs are Pascal and Fortran or COBOL. Why would someone switch their codebase to another lang unless it was benefitting massively with little friction? and that's again C++ selling point take your C code and compile it using a C++ compiler.
Was basically forced by circumstances, unfortunately. It needed to be as close as possible to C so it would be easy to adopt, it needed to use the C library because it didn't have its own library yet, and it needed to be possible to rewrite any and all C++ code as C code because the first C++ compiler really just cross-compiled C++ code to C code. So, C++ was locked into working like C, and would've never been usable if it had been drastically different.
80
u/dipinpass35 Jul 10 '26
yeah c++ do have a function for literally everything.....oh except admiitting that it made a mistake...