jacob said:
Lew Pitcher wrote:
[snip]
What the OP complains about (his direct complaint) is the result of a
failure to validate, and that can happen in any language.
Yes bugs can happen in any language.
I believe misinterpreted NUL termination is unique to the C language.
And what *you* refuse to acknowledge is that a change in the
language will not solve the problems, whatever they are.
And that's why programmers still use the original K&R function
declaration style to this very day ... NOT!
Have you been paying attention to the rapidity of adoption of
the C99 Standard, now approaching its tenth birthday? How much
existing C code did that Standard invalidate? Very little, I think:
People who'd been using `restrict' and `inline' as identifiers may
have been discommoded a bit, but were probably a tiny minority.
Similarly, people who'd already written their own functions named
cacos() and cabs() and so on were no doubt disappointed when C99
expropriated the names; this was probably a larger group than the
first, but still a small one. Yet C99's adoption rate has been
"Slow as molasses running uphill in January," as an old saying goes.
I put it to you, Jacob, that a hypothetical Cxx Standard that
invalidated nearly every existing C program would never be adopted
by anybody at all.
Really? Why do you think that? The Microsoft compiler already
complains at you if you use half of the C library (not that I agree
with their approach, but there's a clear itch being scratched here).
The gcc linker yells at you for using gets(). If the language
actually went in the direction developers with real issues are trying
to go maybe the standard *WOULD* be adopted! Has it not occurred to
you that the reason people didn't adopt C99 is because C99 is in of
itself worthless? It is just impossible to believe that the ANSI C
committee are just a bunch of failures who have received their report
card in the form of lack of adoption of their standard?
[...] It would be a non-starter, dead on arrival, an
object of derision.
Yeah, just like C++ or HTML 2, 3, 4 ...
The failure of adoption has to do with the content of the standard. If
the standard actually had real value in it, I am sure it would be
taken more seriously.
[...] People faced with a choice between spending
their development budget on writing new programs and enhancing old
ones or spending it on retrofitting their existing programs to a new
Standard for no discernible benefit[*] will not spend money on the
latter; they'll keep on using their C99 or C90 compilers, and will
spend a vastly smaller sum on coping with whatever problems ensue.
[*] No, none. Changing a program, for whatever reason, involves
cost and risk. If it's a program that's believed to be working as
intended, has no known bugs that can't be tolerated, and is in all
ways behaving satisfactorily, it will be left alone. Nobody is going
to check the code out, go through the exercise of adapting it to a
new string scheme, check the changed code back in again, and spend
still more money trying to prove nothing got broken in the process,
just so they can have a warm fuzzy feeling about their strings. I
deal with a third party who's still using an ancient compiler that's
so far beyond its end-of-life that we won't offer support at any
price, simply because the program they build with it is working and
they don't want to bother porting it forward to this millennium. I
believe the people in that organization are in no way unusual, but
are simply allocating their resources to more important matters.
Oh that's right. Because every developer in the universe works for
Lockheed Martin. Web browsers and DNS servers are not 40 years old and
many are open source. The dynamics are not as you suggest.
Perhaps the notion is that Cxx would not eliminate zero-terminated
strings, but would offer something else as an alternative, something
that could be used in newly-written code. Fine, but does it solve
the problem that prompted you to start this thread?
I believe it does.
[...] I don't see how.
First, it would do nothing at all for the existing code that already
mangled the existing data.
Except that such code would be known to be "legacy". And if you have
a competitor that has written a better maintained alternative, then
there you go. You don't see a lot of Windows 98 virus announcements
these days do you? So long as there is pressure to upgrade, that
might come *BECAUSE* you can identify code as legacy versus modern,
then this problem gets addressed by market forces.
[...] Second, code is much more often written
to operate with other existing code than written ab origine and in
isolation, which means that there must be a bridge of some kind to
allow the new and old representations to coexist, and in fact to
interoperate. The safety (if achieved) of the new strings disappears
as soon as you push them over into the old-string realm and pull them
back again; they may have been polluted or otherwise mistreated while
abroad.
Not according to the RFC that Lew Pitcher posted (with the full
grammar for some reason). A modern library would allow you to cleanse
string characters more naturally and easily than the pain you endure
trying to implement anything on NUL terminated strings.
[...] Finally, we have it on the authority of one J.N. that nobody
does new development in C anyhow.
And do you think maybe that might have something to do with the state
of the standard? If you give people complex numbers when they are
asking for safer coding libraries with easier or better memory
management is it any wonder that people are eager to look for
alternatives? restrict and inline are clever, but now that I see how
they are used, its clear that they were just short sighted ways for
some system vendors to try to win some benchmark that matters to
nobody. Compare this to the language innovation and ideas going into
Python, Java, Lua, C++, Ruby, Haskell, Erlang, etc.
Your suggestions might lead to a more robust language (or might not,
but let's just suppose). But that doesn't solve any existing problems,
not until somebody can actually use your MRL and use it without
compromising the robustness it supposedly offers. You're not offering
a solution; you're offering -- well, I said it earlier: A complaint.
Well you offer incorrect analysis which is even less.