orignal
November 15, 2025, 4:35pm
1
I was trying to build some old BeOS code and got this error message.
According to the BeBook there were two operator
char operator** (int32 index )** const
inline char &operator** (int32 index )**
However last one has been removed from Haiku’s BString.
What was a rationale of this change? It doesn’t seem necessary, however it causes regression and confuses people using BeBook as a reference.
1 Like
korli
November 15, 2025, 5:38pm
2
It should still be available when using GCC 2.95
See the relevant commit:
committed 07:50PM - 11 Jan 17 UTC
As discussed in 2008
(http://www.freelists.org/post/haiku-development/BString-on… -GCC4,1),
this class was not efficient because of lack of inlining. Implement the
suggested solution of a SetCharAt method instead. Also add a CompareAt
which covers a specific use case in KeyboardLayout.cpp.
Adjust all places which were using this feature to safer APIs.
Also fixes a copypaste error in FormattingConventions.cpp.
1 Like
orignal
November 15, 2025, 5:54pm
3
It still doesn’t explain the rationale behind it. Lack of inlining?
char& operator (int i) { return (const_cast<char *>(String())[i]); }
or implement it as a an external operator
Why break backward compatibility?
1 Like
axeld
November 16, 2025, 1:12am
4
Just follow the link to the discussion mentioned in the commit. IIRC, this allows for much cheaper reference counted copies.
BTW, Haiku aims for binary compatibility; the source compatibility is not that important.
orignal
November 16, 2025, 1:32am
5
How so if there is still String() method giving you direct access to the string buffer?
API consistency is still important, especially since all programming books are written for BeOS, not for Haiku.
1 Like
axeld
November 16, 2025, 10:19pm
6
String() returns a const char* unlike , which allowed to directly alter the underlying buffer.
API consistency is indeed important, but this change does in fact improve it. Consistency does not mean the same as the Be API, and it certainly does not mean we aren’t allowed to change and improve things.
Documentation needs to be updated. And you cannot really expect to get a 25 year old book from your shelf and believe the world hasn’t changed. That is certainly not what Haiku is about, at least.
2 Likes
orignal
November 17, 2025, 12:33am
7
You are right, but unfortunately there is nothing newer to get into Haiku software development. Unless you can recommend one.
axeld
November 17, 2025, 6:01am
8
I only know of DarkWyrm’s programming lessons with Haiku . I’m not sure if that’s kept up to date, though, either.
Apart from that, you could look into the smaller apps that come with Haiku, and learn from those. At least there should be one for pretty much any topic you might be interested in.
Isn’t that a [UB]([dcl.type.cv] ) and explains why it’s been removed?