Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Be's use of C++ (at the kernel/library API/ABI level) would have doomed it in the long term IMHO. There have been several incompatible C++ ABI bumps since then, all of which would have broken compatibility. See the current Be clones which still have to use an ancient version of GCC to not break compatibility with existing software.

NeXT's ABI interfaces (C and ObjC) were and are much more stable.

(I'm not saying don't use C++, just don't use C++ and expect a stable binary API. You need to wrap it in a C API instead unfortunately. There's too much magic in C++ to have a stable ABI and still be able to evolve the language.)



Many OSes written in C++ beg to differ.

C ABI only happens to exist on OSes written in C, thus having a C ABI at all.

NeXT used Objective-C on its drivers framework, and that was replaced by a C++ subset in IO Kit.

Likewise their Metal shaders are based on C++14.

Microsoft has been slow and steady migrating their code into C++ since Vista.

https://www.reddit.com/r/cpp/comments/4oruo1/windows_10_code...

Symbian, GenodeOS, includeOS, mbed are all written in C++.

IBM mainframes were written in PL/I dialects, like PL/S and PL/8, and new code is written in C++.

ChromeOS is written mostly in C++, even if it exposes only Web APIs.

Most of Android native libraries are written in C++.

Of course on ChromeOS and Android, C is still there given the Linux kernel.


You're missing the point. The problem isn't using C++ internally in the OS -- it's exposing public C++ APIs. Because there's no stable ABI, that creates a dependency on the specific compiler.

That's exactly what happened to BeOS and Symbian. Both were stuck at GCC 2.95 for many years after mainline GCC was already at version 4.x.

There's a ton of C++ in macOS/iOS, but it's wrapped to plain C for the public userland APIs.


What happened to BeOS and Symbian was dying before gcc 4.x, released in 2007, became relevant. Nothing to do with C++ ABI.

Other C++ OSes are doing pretty ok.


Symbian wasn't dead in 2007. It was the world's leading smartphone OS and shipped in tens of millions of devices yearly.

Symbian's inability to upgrade the platform to modern compilers definitely was one factor in its failure to gain developer mindshare, and the C++ ABI was the reason for that. They had painted themselves into a corner with a '90s C++ embedded dialect and had no easy way forward.

I'm curious -- which modern OS exposes a C++ API and is "doing pretty ok"? I can't think of any.


No, but no serious OS company migrates to a 4.0 compiler just when it gets released, rather a few years later when it has been proven in the field, by then it was too late.

Migrating to a new C++ ABI wasn't in any way related to Symbians downfall, internal politics were.

As for OSes ARM mbed, Windows all new APIs since Vista are based on COM specially anything UWP related, GenodeOS, Arduino bare-metal libs, IncludeOS.


COM is its own ABI and does not use the C++ ABI:

"Unlike C++, COM provides a stable application binary interface (ABI) that does not change between compiler releases.[3] This makes COM interfaces attractive for object-oriented C++ libraries that are to be used by clients compiled using different compiler versions."

The others seem to be mostly embedded kernels or unikernels which will be tightly linked into your code anyway, so there's no issue of ABI incompatibility with those.


There is no such thing as Language X ABI, rather OS ABI or compiler ABIs.

COM is built on top of C++ VTBL implementation on Windows, UWP extends COM by supporting generics as well.

As for the other OSes, it is irrelevant where they are used, the fact is that they are exposing C++ APIs not C ones.

As matter of fact, had GNU/Linux not taken over the OS world and FOSS projects, and C would be pretty much history by now.

Mac OS, BeOS, Symbian, OS/2, Windows were all adopting C++ APIs when GNU/Linux started to gain adoption, with its manifesto to focus on C for GNU software.


There is no such thing as Language X ABI, rather OS ABI or compiler ABIs.

There is no major C++ compiler on a major OS that provides a stable ABI, so that's what people mean when they say there's no stable C++ ABI.

COM is independent of the Microsoft C++ compiler. It's defined on top of the platform's C ABI. (There's a COM implementation on Mac, for example.)

On Windows, COM uses the stdcall calling convention. There's no trace of C++ there.


Well, the macOS kernel exposes a stable C++ API (IOKit) to third-party kernel extensions.


This is a great point. I understand why a C++ ABI is so hard to keep nailed down, but the inability to do so has really hampered adoption of C++ as a true “system” language.


C++ is a true systems languages on OSes written in C++, there are quite a few of them.


Can you name a few? All the ones I can think of are academic and still require you to recompile all applications when the OS targets a newer compiler.


ARM mbed, the Arduino bare metal libraries.

Symbian was written in C++.


The first two are not really OSes and don't offer binary compatibility (they require recompile-the-world). And Symbian is dead, perhaps partly due to C++'s brittleness.

Any others?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: