[Info-vax] Memory Safe Programming Languages

bill bill.gunshannon at gmail.com
Thu Mar 7 15:50:29 EST 2024


On 3/7/2024 1:41 PM, Simon Clubley wrote:
> On 2024-03-06, bill <bill.gunshannon at gmail.com> wrote:
>>
>> And 40 years ago we had safe C.  We all know how well that
>> survived.  If people weren't willing to choose memory safety
>> back then, why would they be expected to now?
>>
> 
> There's no such thing as a "safe" language.
> 
> What there is are "safer" languages in which it is a lot harder to
> make accidental mistakes, and harder for accidental mistakes you do
> make to remain undetected, especially if you use the full capabilities
> of the language.
> 
> For one really simple example, don't just try to write C code using
> Ada syntax, and place everything in plain Integers, but use the full
> data type modelling capabilities of the language.
> 
> Also, use ranged data types to constrain the allowed values (which was
> something that Rust couldn't properly do the last time I checked;
> attempts to implement this in Rust were part of some addon library,
> not part of the core language).
> 
> The recommendation is to switch to using these "safer" languages, not
> some mythical "safe" language.
> 

But my argument is that C had the chance to be one of those
"safer" languages.  Users rejected it.  Have to wonder why.

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.   :-)

bill







More information about the Info-vax mailing list