Re:Checked C: extension to C that adds static and dynamic ch...
by adrianN on Thursday March 15, 2018 @01:10AM
(#16590539)
Because the programmer can do pointer arithmetic, treat non-char[] memory as char[] memory and probably other weird stuff that makes this more complicated than it sounds, I guess.
[ Parent
| on HN ]
Re:Checked C: extension to C that adds static and dynamic ch...
by m_mueller on Thursday March 15, 2018 @02:54AM
(#16590893)
just make a type where doing pointer math and other such use cases are a compiler error?
Re:Checked C: extension to C that adds static and dynamic ch...
by adrianN on Thursday March 15, 2018 @04:04AM
(#16591110)
Just use a language where types automatically know their size? I thought the point was to make existing code safer by exploiting information that's already there (e.g. the allocator knowing the size of things on the heap).
Re:Checked C: extension to C that adds static and dynamic ch...
by m_mueller on Thursday March 15, 2018 @04:13AM
(#16591143)
The point is that C could be made much safer to use with a few "simple" (at least seemingly) tweaks. C has great tooling support on all platforms, including embedded, so it would be a compelling advancement if the language standard were to include such a thing. The important thing would be to coerce such a string type to character arrays so it remains compatible with all libraries without casting.