In comp.arch.embedded and sci.electronics.design,
No it is not a myth. What is this restrictive that you speak of if it
isn't the strong type checking? It is easier to make a program that
runs in Pascal than C.
Run time check prevent the software from continuing and creating the
"big trouble" I referred to. Running off the end of an array in C can
result in a reformatted hard disk.
While that's definitely possible and "tragic," I don't think that's
quite the worst case. What more often happens is the stuff that "runs
off the end of an array" can be malacious executable code, thus making
an otherwise perfectly good program or operating system vulnerable to
trojan horses, viruses and such.
In Pascal, the program just bombs
leaving the hard disk as it was.
I don't see this as an argument for Pascal NEARLY as much as an
argument for doing proper bounds checking (or asserts) in the code
BEFORE using the argument (in C, FORTRAN or other such language where
array bounds aren't normally checked) anywhere you're not ABSOLUTELY
SURE of the size of the input argument.
This (buffer overflows that can turn program control over to "data"
that came from who-knows-where) appears to be cause of the vast
majority of vulnarbilities in all versions of MS Windows.
Actually, this makes a good argument AGAINST Pascal, and especially
letting its runtime code be the one to check bounds. If you rely on
the compiler/language's bounds checking, you lose control - when an
out-of-bounds access is attempted, the program stops with a run-time
error (is there . The user then becomes confused.
If you write the code to check before doing the access, you retain
control and can take appropriate steps and possibly display a message
appropriate to your program, and keep going. This is especially
important if the program is meant to be continuously running, as would
MANY of the embedded programs developed by those in these two
newsgroups.
Many years ago I went from BASIC to Pascal (and not only survived
but quickly learned to like Pascal much better than BASIC - perhaps I
always smelled the inherent evil in "goto"), went from UCSD on the
Apple II to Turbo on the PC with no problem...
Then I started to learn C. I became frustrated over various points,
for various reasons, partly because of some misleading "how to program
in C" textbook statements, and partly "just because." It was a bit
tough, but I eventually learned that (among other things) Pascal was
doing for me what I should have been be doing for myself, taking
responsibility for things such as proper array bounds checking.