Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!cca!ima!johnl From: johnl@ima.UUCP Newsgroups: net.lang.c Subject: Re: A tuff question about strings - (nf) Message-ID: <376@ima.UUCP> Date: Tue, 16-Aug-83 18:36:15 EDT Article-I.D.: ima.376 Posted: Tue Aug 16 18:36:15 1983 Date-Received: Wed, 17-Aug-83 14:50:29 EDT Lines: 19 #R:sdcsvax:-364800:ima:15900010:000:760 ima!johnl Aug 16 12:18:00 1983 The question is asked whether a C compiler that makes strings read-only is in conformance with K&R.. It appears that it is indeed wrong. The C reference in section 2.5 states that strings are semantically static arrays of characters. The discussion of "static" in section 4 talks about variables, not constants. You might read the exact words a little differently, but the intention is pretty clear. In practice, zillions of existing C programs expect to be able to write on their strings, so that read-only strings will break programs regardless of the moral status of the compiler. John Levine, ima!johnl PS: There has been some discussion of a "readonly" keyword to mark data that should be read-only, but I never heard of it being blessed at Bell.