4 ms·
> Which means Swift, .NET Native, Java/C++, C++17, on the OSes from Apple, Google and Microsoft. You've seen where their OS code comes from, and what it's writ
by teacup50 10y ago
> Which means Swift, .NET Native, Java/C++, C++17, on the OSes from Apple, Google and Microsoft.
You've seen where their OS code comes from, and what it's written in, right?
Just to be very clear, I'm very well-versed in life outside C and imperative programming. This isn't "UNIX culture". This is "systems programming" culture, and it's simply pragmatic.
- pjmlp 10y agoYes I have seen where their OSes come from. Mac OS X and their predecessor might have an UNIX heritage, but C was always left for the very lowest layer. Already on NeXT the device drivers were written in Objective-C, being replaced by C++ on Mac OS X. Anyone paying attention to their Swift talks during the last two WWDCs knows where the boat is steering. Cris is quite clear in stating Swift should be usable in all scenarios where C is being used and Sierra already got some adoption in userland components like the dock and launch deamons, now rewritten in Swift. Microsoft has declared C89 as good enough with the future being C++ and .NET Native. The C runtime library was rewritten in C++ with extern C for the public symbols. The C99 compatibility and upcoming C11 are only done to the extent required by ANSI C++. For anything else there is clang. As of Windows 8, the device driver framework has been changed to C++ and there was a talk from Herb Sutter where he mentioned the plan was to migrate the kernel to compile with a C++ compiler. The idea of Core C++ Guidelines actually originated at Microsoft, before Bjarne and CERN guys got involved. Google doesn't allow native code on ChromeOS and on Android they make pretty clear that the NDK is just to make game developers happy and nothing else. They are all aware that C isn't going away tomorrow, but are driving efforts to make it as relevant in the future on their platforms as Assembly is today. When I started working in IT, the only OS written in C was UNIX. The language is not a sacred cow and the only thing preventing replacing it is the ubiquity of UNIX like OSes. OS not bound to the UNIX culture and POSIX compatibility are free to chose other language as their systems language. Not doing so, is usually a decision to cater to the status quo and ubiquity of existing developers and library (with their endless CVE entries).
- teacup50 10y agoC++ isn't substantially different from C when it comes to systems programming concerns regarding stability. The biggest issue is that it's a bit harder to maintain ABI compatibility. You have to carve out reserved vtable space, avoid exposing STL in your interface, etc, but it's doable. As for Swift, it has heavy userspace dependencies that make it non-viable for kernel work. Rust does much better there.
- pjmlp 10y agoDepends if developers insist on C with Classes or are clever to take advantage of the language features that make it a safer language. Regarding Swift, C developers used to tell me C++ would never be used to write kernels, because it had a runtime and was too bloated. Since those days, I have seen BeOS, Symbian, Genode, Mac OS X IO Kit, Windows 8+ Kernel Driver Framework. Also not to forget, Objective-C kernel code used in NeXT. Also the biggest open source C compilers are nowadays written in the language which those C developers considered too bloated for any real work.