It's unfortunate that some OS APIs still require null-termination, since it means you have to downshift at that interface :(
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
The one case I can think of - just need to define width of "char". Leading length needs width & endian defined.
-
But that's only interesting for network traffic, and it's still not THAT interesting.
- Show replies
New conversation -
-
-
Sentinels lead to more efficient code in common cases. E.g. a lexer where the end check can be part of a char switch.
-
I agree it's annoying to have it forced upon you. E.g. it makes memory mapping files as strings much more annoying.
- Show replies
New conversation -
-
-
No, it's not nearly that simple. When you are dealing with substrings, you are now forced to allocate-and-copy.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Yeah, I've definitely done that :) But this breaks a lot of things (multithreading, for instance).
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
if doing string tables, it is fairly memory-dense and allows easily finding the ends of strings.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
It's not really feasible to map memory at a byte-level.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
For an API maybe, but the length is usually the first N bytes. Maybe alloc space at both start and end anyway?
-
I would argue no, you never put the length in the first N bytes. It should be separate. I think this is better.
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.