Path: utzoo!utgpu!water!watmath!clyde!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: string assignment in C Message-ID: <9710@haddock.ima.isc.com> Date: 20 Oct 88 03:30:58 GMT References: <1988Oct11.143728.28627@gpu.utcs.toronto.edu> <6777@chinet.chi.il.us> <1414@imagine.PAWL.RPI.EDU> <790@paris.ics.uci.edu> <8696@smoke.ARPA> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 12 In article <8696@smoke.ARPA> gwyn@brl.arpa (Doug Gwyn) writes: >... As it stands, if p1 and p2 are pointers to const char, the storage may be >shared, but not if they are pointers to char.... Thus the automatic "dumb" >crunching together of string literals is not permitted in a standard- >conforming implementation. True in K&R C, but fixed in dpANS: "Identical string literals ... need not be distinct. If the program attempts to modify a string literal ... the behavior is undefined." [3.1.4] "This specification allows implementations to share copies of [identical] strings." [R3.1.4] Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint