4 ms·
You can write plenty of Mac and iOS programs - and much of the OS, and even XNU are - in C++. You can't use the UI toolkits, because time has shown again and a
by olliej 3y ago
You can write plenty of Mac and iOS programs - and much of the OS, and even XNU are - in C++.
You can't use the UI toolkits, because time has shown again and again that C++ is particularly bad at UI toolkits, but also as my other longer answer said, idiomatic Cocoa and UIKit programming has significant subclassing of ui components, and even the most robustly and carefully designed C++ frameworks can't manage ABI stability well (if at all) in that case.
It is pretty standard on apple platforms to have a ton of C++ doing things C++ is good at interacting with things in ObjC and Swift, and the fact the Apple is working to improve the c++/swift interop when every other new language has the response of "who cares about C++ interop? they can just write c interposition layers until they can replace an entire subset of the library all at once" demonstrates how important and well supported C++ is on the platform.
Long term who knows. Despite the questionable equivocation about safety from Herb&Bjarne modern C++ is not safe, and new features that introduce lack of safety keep getting added while long term failings like the over reliance on UB for definable behaviour[1], and as long as that attitude remains my hopes for actually getting C++ to a place it can be used safely if it can ever be exposed to attacker control data remain low, and so the future would eventually see C and C++ being dropped everywhere. Looking forward to safe languages in the kernel: swift, rust, and the most popular safe language in the world: javascript!!!! :D
[1] C++ has "unspecified behavior" and "implementation dependent behavior" that allow for different behaviour that people claim UB is needed for, without the "compiler can pretend this doesn't happen" nonsense