Unless you were in my office watching me when I read your message, and
used a stopwatch to time how long it took me to think about it, there's
no way you can know whether my dismissal was immediate or took a
considerable amount of time.
Oh I see, I'm all wrong because I used the word immediately in there
(referring to where in the post it was, and the fact that you don't
even acknowledge my position at all.)
[...] Your insistence that I it was immediate,
There are many other words I used in there other than "immediate".
Interesting that you are obsessing over that one. So if I ask you if
you've stopped beating your wife with a broomstick, will you scream at
me for suggesting that you own a broomstick?
[...] It's also not a dichotomy: low-level languages are inherently
unsafe, [...]
No. They may contain unsafe ways of using them. This says nothing
about the possibility of safe paths of usage.
Well, if you want to change the terms of discussion, you should warn
us.
I have not presented a position to the contrary of this. I'm not
changing anything, from my point of view. Its only your false
dichotomies that are preventing you from seeing that this is what I am
talking about, and that I am not actually talking about anything else.
These other tangents have not been introduced by me.
[...] There are safe paths of usage for C,
They are not obvious, and the mountains of CERT advisories suggest that
they generally are not travelled.
[...] too (they don't involve any
use of gets(), except in contexts that are so rare and unlikely that
they don't constitute justification for continuing to retain gets() in
the standard). If a low level languages can be considered safe if
there's a safe way to use it, that pretty thoroughly undercuts your
argument that C is unsafe.
Not if those paths are hidden or highly non-obvious. Or, require a
complete built up from scratch. The safety, measured in actually
resultant code which is "safe" (basically correctly implemented,
without unintended side-effects), will be primarily influenced by the
most often taken paths by the programmer to solve their problems. If
the most obvious libraries have land mines all over them, then
programmers are going to step on those landmines at some rate.
For most rational people, given that the problems are being highlight
by the mainstream press on a weekly basis, this would lead to a very
obvious question -- is it possible present an interface where the most
likely to be used paths are not nearly as dangerous as what C presents?
And if so, what are the minimum trade offs? In the case of Bstrlib,
as a substitute for C's string library, the answer is "yes you can make
such a thing, and the trade offs are none."
[...] Even gets() is safe: the safe way to use is "never".
Tell that to the ANSI/ISO C committee. According to their own
documentation they claim that gets() can be used under some unspecified
environmental assumptions.
Note: by this definition, a knife containing sharp poison-soaked pins
all along it's handle is safe, because there are ways to use it safely.
Personally, I'd recommend a different definition of "safe".
Really? Because I prefer the one that will ultimately lead to safer
code in real world production.
You were the one who claimed the existence of a false dichotomy.
Dichotomies are by definition not fuzzy; especially the false ones -
the word derives from a Greek(?) work meaning "cut", referring to
making a sharp distinction between two different categories. The claims
that you were labelling "false dichotomies" are entirely consistent
with the fuzzy idea that higher level languages are safer than low
level languages.
Reread the definition. That's not what it means.
I agree; it's the suggestion that fixing those wholes will make C safe
that I'm arguing against. As long as C retains anything remotely
resembling a pointer; in other words, as long as C continues to
remotely resemble anything like the current version of C, it will be
less than perfectly safe (except in your modified sense, in which the
fact that something that can be used safely is safe.)
And so who was arguing for perfect safety again? Please find the
applicable quote.
[...] If it protected your access to those features, that
protection (regardless of what form it takes) would make it a
high-level language.
So you are saying C becomes a high level language as soon as you start
using something like Bstrlib (or Vstr, for example)? Are you saying
"high" -> "higher". As you say, it's all relative.
At least in the case of Bstrlib, this is a ridiculous notion. No
low-level path is removed or obscured. Nothing is abstracted to any
degree in which the representation isn't known exactly. No
functionality or capability is given up, theoretical or otherwise.
Using Bstrlib, you remain at exactly the same low-leveledness as
without it, because you can do all of the exact same things you did
before. You just happen to also have the option of doing things safer
and faster.
Saying Bstrlib makes C more high level, is like saying AMD's 64 bit
instruction set makes the x86 more RISC-like because they added more
registers.
More severe failures -> more unsafe (all else being equal). If you
think a system where a particulare error causes a compilation to fail,
with a clear error message pointing to where the problem may be found,
is just as safe a system where the same error causes a nuclear bomb to
explode, that's a might peculiar way of assessing risk. On both
systems, the same error causes a failure; the only difference is the
serverity of the failure.
Ok, but this is irrelevant. You can't change the specification of C to
make it decrease the severity of UB. You can only act on the
probability of failure occurrences. Furthermore, severe errors are
*NOT* confined to low-level languages. Java has race conditions, which
are arbitrarily bad, and nobody considers Java a low-level language.
I know almost nothing about Ada. But I guarantee you that in the
unlikely event that Ada is perfectly safe,
No real language is perfectly safe. You would have to take loops out.
What the hell are you talking about? Ada is fairly safe; rather than
detailing something I only have modest familliarity with, let me just
point out that the US military up until recently used Ada exclusively
basically because it is a safe language (and they do not consider Java
any safer.)
[...] it's pointers can't be exact conceptual equivalents of C pointers.
You mean Ada is not C? That is correct.
No, I'm just saying tha by comparison with most of the other
non-assembly languages, it has a reputation for speed, not slowness.
Right, as I've posted before C has lots of "FAKE SPEED", that makes
people think its a fast language. Its like how sporty commuter cars
have spoilers or impressive air intake grills, and are really amazing
aerodynamic. Its utter nonsense, and has nothing to do with anything
about the car's performance -- but it looks cool. Same thing with the
C.
You're characterization of it as slow comes across as mighty peculiar.
I'm sure it does to you, if you've bought into the silly notion that C
is a fast language.
It may be well known, and there once was a lot of truth to that claim,
but it's no longer universally true.
Uhh ... excuse me, but it will remain true for as long as "restrict" is
not widely deployed on enough C compilers, to compell programmers to
use it.
[...] It used to be that the Fortran
compilers represented many more decades of refinement than C compilers.
The state of the art C and Fortran compilers from Intel (which win
basically every benchmark there is) uses a common backend (i.e., they
both compile to the same intermediate language, before being optimized
then translated to assembly). The C language can only keep up with the
Fortran on linear algebra stuff, if restrict is used (in which case the
two become equivalent) or some unsafe switch like "assume no aliasing"
is set for the C compiler.
However, C's been around for many decades by now, and C compilers have
caught up with, and in some cases surpassed, the competing Fortran
compilers.
Not on numerical stuff. Compiler technology has nothing to do with it.
The language is simply a barrier.
[...] On many platforms, including the one I'm currently using,
the fortran compiler works by creating intermediate C code and passing
it to the C compiler.
Oh you mean like the Absoft compiler? Go look at the polyhedron
benchmark site to see how worthless that is as a strategy for compiling
Fortran. Only marketroids from Apple, with a specific intention of
decieving people on benchmarks would ever use such a kind of compiler.
Excuse me, but gets() is in the C specification, and *MUST* lead to
unsafe usage of buffers. Most C string function require implicit
assumptions about buffer lengths that are unchecked by any mechanism.
C includes necessarily non-reentrant functions like strtok(). Assembly
present you with no such weaknesses from its baseline specification.
[...] Like assembler, it allows intrinsically unsafe usage.
Like assembler, C doesn't require unsafe usage.
Unlike C, assembler does not *promote* unsafe usage. You can only
program "unsafely" in assembler, if you create the unsafe scenario,
specification, and semantics from the group up.