Read-only Strings, and the (const) cast

Henry Spencer henry at utzoo.UUCP
Sat Oct 27 06:58:06 AEST 1984


> I don't really like the idea of the funny type cast, where
>     (const) "abc"
> gives a string in read-only storage. ...

Actually, it's worse than that, although your major point ("having the
cast affect the thing pointed to as well as the pointer is bizarre")
is valid.  It's worse because the above is not a legal C fragment; it
would have to be

	(const char *) "abc"

Bletch.  Down with writeable strings!
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list