Sujet : Re: No warning at implicit removal of const. Was: relearning C: why does an in-place change to a char* segfault?
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 02. Aug 2024, 14:59:40
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v8iood$2rhnh$1@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Mozilla Thunderbird
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.