3 ms·
C's "inherent inner workings" appear to rely on the fact that every char array has to be null-terminated. That then implies at minimum a sanitation of user- an
by klingonopera 7y ago
C's "inherent inner workings" appear to rely on the fact that every char array has to be null-terminated.
That then implies at minimum a sanitation of user- and data-input of char array, and maybe an absolute maximum overrun char count protection at execution, but once your default is to keep track of every string length and not the opposite of keeping track of specific strings, I'd kinda agree with above that it's not really "C"... more like your own implementation of a(n overrun-safe) string library?
Inherent to the concept of the char array is that a size value would be redundant, for it is the position of the null-terminator that already contains/is this.
The analogy for the string concept of a char array's missing null-terminator is actually a wrong size value.
I ask myself, why are strings safer?