Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: does char *str="abcd"; alloc addressable memory? Date: Mon, 24 Aug 2020 17:04:36 -0700 Organization: A noiseless patient Spider Lines: 60 Message-ID: <864korbnfv.fsf@linuxsc.com> References: <87k0zgbiwt.fsf@nosuchdomain.example.com> <6HCNG.37756$bQ4.31924@fx04.iad> <86fta0fw7j.fsf@linuxsc.com> <87o8oo8s31.fsf@nosuchdomain.example.com> <867dvbfk4b.fsf@linuxsc.com> <87k0zb6r7u.fsf@nosuchdomain.example.com> <87ft9z6qgo.fsf@nosuchdomain.example.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="dbf2c1c6727d6e7d136c7ce606efe473"; logging-data="18351"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18JURBL9DzgVSK/ABRagd2PaNqPPaT0hvA=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:5G5ZDI0D18p6p/e2waYEFTSG9KA= sha1:oxiwHxn5gOahuU7H6TNPSYexHDE= Xref: csiph.com comp.lang.c:153998 Keith Thompson writes: > Keith Thompson writes: > >> Tim Rentsch writes: >> >>> Keith Thompson writes: >>> >>>> Tim Rentsch writes: >>>> [...] >>>> >>>>> Much more recently than that, gcc had an option -fwriteable-strings. >>>>> That option has since been removed, but it was still available in >>>>> the last ten years or so. >>>> >>>> The "-fwritable-strings" option (note spelling), >>> >>> Right. Either the option was misspelled in one of the sources I >>> found, or I made a mistake in copying it. Either way thank you >>> for the followup. >>> >>>> was removed in 2004. >>>> The version string for the commit that removed it was >>>> "3.5.0 20040223 (experimental)". >>> >>> If the first commit was to an experimental version in 2004, the >>> feature would still be available in production releases for at >>> least several years, and probably more than that considering >>> delays in upgrading distributions, etc. In any case it's still >>> a lot more recent than the 1980s, and even after C99 was done. >> >> I think gcc just adds "(experimental)" to the version string for >> any non-released version. The change would have been part of gcc >> release 3.5.0 if it had existed. >> >> The "-fwritable-strings" option was deprecated starting in release >> 3.4.0 (committed 2004-04-19) and removed starting in release 4.0.0 >> (committed 2005-04-21). The most recent release that supported >> the option was 3.4.6 (committed 2006-03-06). (The oldest version >> of gcc I currently have access to is 4.1.2.) >> >> I'm sure it took several years before distributions stopped >> supporting gcc 3.X, but I don't have data on that. > > More background: This is from the manual for gcc 3.4.6: > > @item -fwritable-strings > @opindex fwritable-strings > Store string constants in the writable data segment and don't uniquize > them. This is for compatibility with old programs which assume they can > write into string constants. > > Writing into string constants is a very bad idea; ``constants'' should > be constant. > > This option is deprecated. > @end table Sounds right. And except for the misspelling, which I already acknowledged, all consistent with what I said earlier.