In their kernel they're using a subset of 1990s C++ that gives them much less functionality than the C++ aficionados have been talking about in these comments.
All non-core components use only C APIs even though they may be in C++. So many of the examples mentioned for Linux would still have to be done the same way since they're available in blessed module APIs for Haiku.
And despite a decade's work what they have is basically a BeOS clone. Nasty shortcuts to rush BeOS to market before Be Inc. ran out of money, faithfully reproduced. That goes from big picture things like no privilege separation and no power management to little annoyances like no real hot plug (they have a hack that lets them hotplug USB devices by first loading all the drivers they might want...)
Posted Jun 3, 2011 13:07 UTC (Fri) by cmccabe (subscriber, #60281)
[Link]
> In their kernel they're using a subset of 1990s C++ that gives them much
> less functionality than the C++ aficionados have been talking about in
> these comments.
*Everyone* is using some kind of subset of C++.
Firefox and Chrome, as well as Webkit, are using -fnoexceptions and -fnortti. This is a pretty important design choice because it means that you can't do things that can fail in your constructors, since there is no way for them to report errors except throwing exceptions.
XNU, which later became the basis of the Mac OS kernel, uses a restricted subset of C++ that doesn't allow exceptions, multiple inheritance, or templates.
If projects do use exceptions, they all do it differently. Some old Microsoft APIs throw pointers to exceptions, which the caller must then manually call delete() on. Most projects roll their own exception hierarchy. Sometimes they inherit from std::exception; other times not. Sometimes they throw other things. I heard from a friend that his team is writing new code that throws ints! Yes, new code, written in 2010, that throws ints.
Some projects use char* almost everywhere, other projects use std::string. QT has its own string class, which is supposed to be better at internationalization, that a lot of projects use. Some projects use a mix of all of this stuff. Some projects roll their own string class.
A lot of projects rolled their own smart pointer, or used one from boost, prior to the introduction of tr1::shared_ptr. Some of them work similarly, others not. Some projects barely use smart pointers; other projects use them almost everywhere.
*Everyone* is using some kind of subset of C++. Everyone is bitterly convinced that they are right and everyone else is wrong. When someone advocates "using C++," a legitimate question is "which C++"? When you add a new person to your team, you can expect to spend quite a bit of time getting him or her up to speed.
And of course, the different subsets of C++ don't interoperate that well at the library level. So when designing APIs, everyone just uses the lowest common denominator, which is C or something that looks almost exactly like it.
Haiku
Posted Jun 3, 2011 15:43 UTC (Fri) by daglwn (subscriber, #65432)
[Link]
> *Everyone* is using some kind of subset of C++.
Not true, and if they are, they're Doing It Wrong.
Boost, for example, places no such restrictions on the project. Instead, members use vigorous code review to ensure quality. That is the right way to go because terrible interfaces get designed in every language every day. Restricting the set of allowed language features doesn't solve that problem, it exacerbates it.
Haiku
Posted Jun 3, 2011 19:16 UTC (Fri) by cmccabe (subscriber, #60281)
[Link]
> > *Everyone* is using some kind of subset of C++.
>
> Not true, and if they are, they're Doing It Wrong.
Really? Let me ask you: when was the last time you wrote code that used throw specifications? Or the "export" keyword for templates? Or wide character streams (wchar)? Have you ever used protected inheritance?
Wake up and smell the coffee. You're programming in a subset of C++. You are no doubt convinced that your subset is "modern" and "progressive", whereas everyone else's is "backwards" and "old-fashioned". But it's still a subset.
Haiku
Posted Jun 3, 2011 21:09 UTC (Fri) by daglwn (subscriber, #65432)
[Link]
This makes no sense. If this is your criteria, everyone programs in a subset of their favorite language. When's the last time you used gets()?
The point is that the tools to use shouldn't be artificially restricted. If someone wants to use protected inheritance, let them as long as they can show why it's necessary or beneficial.
Haiku
Posted Jun 4, 2011 1:07 UTC (Sat) by cmccabe (subscriber, #60281)
[Link]
You're mixing apples and oranges. gets() isn't a language feature, it's a library function.
> The point is that the tools to use shouldn't be artificially restricted.
> If someone wants to use protected inheritance, let them as long as they
> can show why it's necessary or beneficial.
You didn't answer my question. When was the last time you used those features?
You say that programmers shouldn't be "artificially restricted" from doing things that are "necessary and beneficial", but those are weasel words. The reality is, you'll just define necessary and beneficial as whatever you've been doing. So if you've been throwing exceptions as pointers, it's obviously "necessary and beneficial" for the new code to do the same. If you haven't been using throw specs, obviously the new code shouldn't have them. But you're not using a subset of the language, oh no.
As a side note, what's with the gets() obsession in these programming language debates. I don't think I was even alive the last time someone used gets() in a real program.
Haiku
Posted Jun 4, 2011 1:11 UTC (Sat) by cmccabe (subscriber, #60281)
[Link]
Literally every comment has a completely different view of which C++ features are "evil." I don't think you can find even two distinct answers that agree. I can only imagine what a novice programmer, fresh out of school, would think after reading this :)
Haiku
Posted Jun 4, 2011 5:52 UTC (Sat) by elanthis (guest, #6227)
[Link]
It saddens me that it's become the norm to expect a "novice" who's had a full four years worth of a $100,000 education to have his first experience with real-world languages be a StackOverflow posting.