To read all comments associated with this story, please click here.
Most modern pascal compilers let you use a string also as an array of chars. While it's true that string is an abstraction, the notion of string exists even on hardware implementations - check scas* opcodes on x86. (And yes, I'm aware those aren't string-specific, on the sense of char array)
The lack of abstraction is C's problem. You are being tricked into thinking your program is portable when it isn't. Just because you can compile your C program on any platform doesn't mean it'll do the same on every platform:
C doesn't abstract endianess. It doesn't abstract a platform's native memory alignment or pointer size. Strings as null-terminated byte arrays don't work with 16bit Unicode (which you should expect that one or the other function on a target platform may actually return - like a file name).




Member since:
2005-07-06
That's not a misfeature. In the hardware, strings ARE arrays of chars. A string is an abstraction and C doesn't hide that from you.