Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!rex!ukma!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: shared storage for string literals? Message-ID: <16293@smoke.brl.mil> Date: 29 May 91 07:35:53 GMT Article-I.D.: smoke.16293 References: <21996@ogicse.ogi.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 14 In article <21996@ogicse.ogi.edu> vegdahl@ogicse.cse.ogi.edu (Steve Vegdahl) writes: >The ANSI standard states that two identical string literals may share storage. Actually it says that identical string literals need not be distinct. >Question: can non-identical substrings share storage if one is a substring >of the other, and they share a common "tail"? Sure. The standard doesn't allow a strictly conforming program to modify string literals, so this would be a safe implementation practice, and I would be greatly surprised if no C implementation were doing this. Surely any application that depended on nonoverlap would be depending on something that the standard does not guarantee.