Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: James Kuyper Newsgroups: comp.lang.c Subject: Re: No warning at implicit removal of const. Was: relearning C: why does an in-place change to a char* segfault? Date: Fri, 2 Aug 2024 09:59:40 -0400 Organization: A noiseless patient Spider Lines: 15 Message-ID: References: <20240801174026.00002cda@yahoo.com> <87zfpvfdk4.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Date: Fri, 02 Aug 2024 15:59:42 +0200 (CEST) Injection-Info: dont-email.me; posting-host="fc09beaaa05891c9bcdd65835817b51b"; logging-data="3000049"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190AmugpReRtMR/uvQnHBUMopge+8UvK94=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:4FsC8zgNqSA5BGGk/9RHVCFqH7k= In-Reply-To: Content-Language: en-US Bytes: 1748 On 8/2/24 08:04, Richard Harnden wrote: .... > Is there any reason not to always write ... > > static const char *s = "hello, world"; > > ... ? > > You get all the warnings for free that way. If you hate being notified of the errors that can be caught by appropriate use of 'const', as many do, that can be considered a disadvantage. I can't claim to understand why they feel that way, but such people do exist.