Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[language troll] D vs C++ vs C# vs Objectve C

Name: Anonymous 2005-10-19 2:37

ITT we post our opinions on which language is better at (performance || being object oriented || portability || whatever) and is the proper successor to C.

Name: Anonymous 2005-10-25 7:16

Yes, IBM has a (supposedly) superb library named ICU (although I believe it's for C++) with full Unicode support, which may be used freely. Then there's BString, without Unicode support, which does something similar to what we're saying.

You're right about exponentially increasing the size.

As for speed, I don't think we'd need a custom memory manager; even though realloc sounds horrendously slow from a C perspective, it's still faster than what every other language would do, and it wouldn't happen too often. For example, consider Java. Every time you want to do anything, even modify a character without altering the string's length, it just throws it away and allocates a new string. That's terrible, plus it's O(n) (because of copy). I don't think even Python, Perl or PHP would be faster than eventual, logaritmic reallocs.

I don't know how's realloc() implemented, and if it's going to copy the original block all the times; if it doesn't, then fine; if it does, then we might want to do something like malloc(new size), copy only the part of the string that's actually in use, copy data fields, free(old block), which would still be linear but a considerable optimization.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List