Re: Null-terminated strings: the final analysis.
- From: "Tony" <tony@xxxxxx>
- Date: Sat, 11 Apr 2009 23:06:10 -0500
"Bartc" <bartc@xxxxxxxxxx> wrote in message
news:CFusl.4007$Lc7.1359@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
"Tony" <tony@xxxxxx> wrote in message
news:vsnsl.13862$W06.5350@xxxxxxxxxxxxxxxxxxxxxxx
Null terminated strings are premature optimization when considered in
modern times. Null-terminated strings are baggage and C suffers from
holding on to this obsolete implementation. (No question here, just
wondering now why a computer programming language should age like a
person?). Comments welcome of course.
This was discussed here recently, quite extensively too.
And they are not just a C thing, they were and are used ubiqitously
elsewhere, very successfully.
Your alternatives I recall would not fit easily into the low-level C
model.
"easily" is a subjective term, so your thought needs qualification to be
understood. I have a R&D design where a one-character string is one byte
(read no overhead), small (Pascal) strings have one byte of overhead (the
length) and larger size strings have a few bytes more (but so what? they're
larger strings!). The usage though is via one abstraction.
As criteria for string implementation analysis, I see: space efficiency,
time efficiency, practical usage (usage patterns are much different now than
then and the std implementation may be/may have impeding/impeded progress),
_maybe_ "one technique to cover all string types" (like literals, e.g.),
character set requirement (Unicode highly overrated IMO), and some decidedly
not that important issues.
Tony
.
- Follow-Ups:
- Re: Null-terminated strings: the final analysis.
- From: Mark McIntyre
- Re: Null-terminated strings: the final analysis.
- Prev by Date: Re: Anything to worry about (compiler warnings)?
- Next by Date: Re: Omitting return in non-void function
- Previous by thread: Re: Null-terminated strings: the final analysis.
- Next by thread: Re: Null-terminated strings: the final analysis.
- Index(es):
Relevant Pages
|