[Info-vax] Memory Safe Programming Languages
bill
bill.gunshannon at gmail.com
Fri Mar 8 09:38:21 EST 2024
On 3/8/2024 8:14 AM, Simon Clubley wrote:
> On 2024-03-07, bill <bill.gunshannon at gmail.com> wrote:
>>
>> But my argument is that C had the chance to be one of those
>> "safer" languages. Users rejected it. Have to wonder why.
>>
>
> Did it fix only one special case - buffer overflows - or was it
> a safer language in general ? For example, how strong was type
> checking in this safer C ?
Misuse of functions
mismatched parameters
array indexing/out of bounds
stray pointers
Arithmetic errors/division by 0/overflow
misuse of standard I/O
misuse of string functions
Don't know what else it might have done as all I have are
the descriptions in the Software Sourcebooks.
As an interesting side note, this was not only available for
all the PDP-11 OSes it was also available for Ultrix-32 and
VMS.
>
>> And, on another note regarding C and Ada. The original GNAT
>> compiler converted Ada into C and compiled it with GCC. Now,
>> it seems to me that points at two possible concepts. One is
>> that if Ada can be done in C then it has all the same flaws
>> and warts. Not sure I would like to go in that direction.
>> The other is much more interesting. And that is the concept
>> that C can, obviously, be just as safe as Ada. The question
>> then becomes why isn't it? See my first paragraph. :-)
>>
>
> Well, that's a load of nonsense and shows a total lack of understanding
> of how compilers work. All compiled languages are ultimately compiled
> into assembly language opcodes. That doesn't mean they are only as safe
> as the assembly language they are compiled into.
Well, I did discount explanation 1. :-)
But, explanation 2 still stands. If the "safe" code written in
Ada can be converted to C then, obviously, the same "safe" code
could be written directly using C. The question really is why do
programmers choose not to.
>
> OTOH, it could sound like the reasoning of someone trying to desperately
> claim that C is somehow as safe as Ada. :-)
It is. It is not any shortcoming in the language that makes C
"unsafe". It is the practices of the programmers.
>
> Also, how long did this GNAT compiler that translated into C
> actually exist for ? Was it something that once existed for a couple
> of years about 30-35 years ago and was never used again.
Really don't remember. That was more than a lifetime ago in
computer years. :-)
>
> I first started really using Ada compilers around the gcc 2.8 timeframe
> (IIRC) and have never encountered this Ada to C translator you speak of.
A lot of the early Gnu compilers started as translations to C
and compilation with GCC. P2C, F2C As has been stated many times,
C is really just a slightly higher level than assembler.
You know, one can easily write buffer overflows, out of bounds arrays,
type mismatches, etc. with assembler but no one blames the assembler
for it.
bill
More information about the Info-vax
mailing list