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?

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: does char *str="abcd"; alloc addressable memory?
Date 2020-08-24 17:04 -0700
Organization A noiseless patient Spider
Message-ID <864korbnfv.fsf@linuxsc.com> (permalink)
References (6 earlier) <86fta0fw7j.fsf@linuxsc.com> <87o8oo8s31.fsf@nosuchdomain.example.com> <867dvbfk4b.fsf@linuxsc.com> <87k0zb6r7u.fsf@nosuchdomain.example.com> <87ft9z6qgo.fsf@nosuchdomain.example.com>

Show all headers | 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