Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #153998

Re: does char *str="abcd"; alloc addressable memory?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Tim Rentsch <tr.17687@z991.linuxsc.com>
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> (permalink)
References <rdv1l5$clo$1@reader1.panix.com> <rdv1vh$idl$1@dont-email.me> <87k0zgbiwt.fsf@nosuchdomain.example.com> <re0oqg$4kj$3@reader1.panix.com> <re18kf$2v2$1@dont-email.me> <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

Show key headers only | View raw


Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>
>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>
>>>> Tim Rentsch <tr.17687@z991.linuxsc.com> 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.

Back to comp.lang.c | Previous | Next | Find similar


Thread

Re: does char *str="abcd"; alloc addressable memory? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-08-24 17:04 -0700

csiph-web