4 ms·
I feel like C-style strings were nearly inevitable given C's array-pointer duality law. Square bracket array operations just translate into simple pointer arith
by staplung 1y ago
I feel like C-style strings were nearly inevitable given C's array-pointer duality law. Square bracket array operations just translate into simple pointer arithmetic. To have a length prefix byte you'd need to either make the compiler treat char* differently than other arrays/pointers or you'd need to have the programmer always account for the special byte at the beginning of the string.