On Tuesday, 18 November 2014 at 02:35:41 UTC, Walter Bright wrote:
On 11/17/2014 3:15 PM, "Ola Fosheim Grøstad"
<ola.fosheim.grostad+dl...@gmail.com>" wrote:
Ok, but I would rather say it like this: the language C
doesn't really provide
strings, it only provides literals in a particular format. So
the literal-format
is a trade-off between having something generic and simple and
having something
more complex and possibly limited (having 255 char limit is
not good enough in
the long run).
The combination of the inescapable array-to-ptr decay when
calling a function, coupled with the Standard library which is
part of the language that takes char* as strings, means that
for all practical purposes C does provide strings, and pretty
much forces it on the programmer.
I think there is a certain kind of beauty to the minimalistic
approach taken
with C (well, at least after ANSI-C came about in the late
80s). I like the
language better than the libraries…
C is a brilliant language. That doesn't mean it hasn't made
serious mistakes in its design. The array decay and 0 strings
have proven to be very costly to programmers over the decades.
Heartbleed is a nice example.
The amount of money in developer time, delivery software updates
to customers and buying new hardware with firmware that cannot be
replaced.
This is just one case, the CVE List gets updated every day and
90% of the issues are the usual C suspects regarding pointer
misuse and out of bounds.
Anyone writing C code should by following practices like
https://wiki.debian.org/Hardening
--
Paulo