A couple of weeks*ago I wrote a blog post, available on Embarcadero blog site at
https://blogs.embarcadero.com/is-del...safe-language/, to follow up on the online discussion started by a US government paper you can read about in many articles, such as*
https://www.tomshardware.com/softwar...ming-languages
Here I want to add a couple more links.
The first very nice article by Craig Chapman, titled "Memory Safety and Object Pascal" (see*
https://chapmanworld.com/memory-safe...object-pascal/). I agree with what Craig writes. C++ can be used in a safe way, but it's more difficult to do it compared to other languages like Delphi and Rust. This is to point out that memory safety doesn't necessarily implies garbage collection. If you read the original document from the US government, there is a clear indication that some software requires a high degree of stability and reliability and much more memory control than a GC offers. Delphi is there, extremly fast runtime, and consistent results and performance (no change a GC kicks in at a bad time). This does require some discipline as a developer, but the language and its
RTL helps a lot.
There is also a significant rebuttal of the argument in that document by the C++ community, starting with C++ creator,a s you can read in "C++ creator rebuts White House warning" at*
https://www.infoworld.com/article/37...e-warning.html. The main argument here is that modern C++ can be safe, but the same article highlights that very little C++ code out there qualifies as modern C++. The plan to introduce new solutions would also imply a significant rewrite of existing C++ applications.
One element I mentioned already and I want to underline, and that is present in the research and documents behind the recent US government paper, is*that memory safely in terms of allocations and references is only one of many elements. Type safely is mentioned a lot. While Delphi has pointers, Pascal has typed pointers from day one. Having a pointer to Integer and increasing it by 1 to move to the next element of a data structure is arguably much safe than using a generic pointer and increasing it by 4 or 8 depending on the pointer size.*
Also consider the use of strings in Delphi, compared to C and C++. Or dynamic arrays. Or the fact core types like integers and characters or Boolean*are not all equivalents. A stronger type system implies more compile time checks and fewer runtime checks and runtime errors.
Weiterlesen...