CBFalconer said:
There is a major problem here. There is no such thing as a "string
type" in C. There is only a data format for use in a char array.
This consists of characters, extended and terminated by a '\0'
char. That char marks the end of the active string.
I think you've missed (or are deliberately ignoring) the context.
jacob announced a string library; a "string" here is presumably some
type specific to the package, not a "string" in the sense defined in
the C standard. I.e., it's something that represents or contains a
sequence of characters. <OT>C++'s std::string is an example of
this. said:
No cast will so alter the char array, and there is no guarantee
that there is even room to append the '\0' termination marker.
Remember that, in accurate C, a cast is usually an error. The
prime exception is variadic parameters.
Sure, but lcc-win, on which this string library depends, supports
operator overloading. Apparently the cast operator is overloaded so
that (char*)s invokes a function that returns a char* value that
points to a valid C string, given that s is an object of the "string"
type provided by the library.
Complain that this is off-topic if you like, but pretending,
deliberately or otherwise, that jacob means the same thing the
standard does when he talks about a "string library" is not helpful.