Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <87v80ig4vt.fsf@nosuchdomain.example.com>
Deutsch   English   Français   Italiano  
<87v80ig4vt.fsf@nosuchdomain.example.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
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, 02 Aug 2024 11:24:06 -0700
Organization: None to speak of
Lines: 26
Message-ID: <87v80ig4vt.fsf@nosuchdomain.example.com>
References: <IoGcndcJ1Zm83zb7nZ2dnZfqnPWdnZ2d@brightview.co.uk>
	<20240801174026.00002cda@yahoo.com> <v8gi7i$29iu1$1@dont-email.me>
	<slrnvaorkl.34j6.candycanearter07@candydeb.host.invalid>
	<87zfpvfdk4.fsf@nosuchdomain.example.com>
	<v8ii17$2q5p1$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Fri, 02 Aug 2024 20:24:06 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ce4d2d563452819094f001112239b02f";
	logging-data="3106916"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18QRITsskHrvw/NmwswixlN"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:DornZb5EOB7LfkqCRc74mj5AqCk=
	sha1:xSCtuII8pw9Zb1Nh8zzEMRe8mg0=
Bytes: 2135

Richard Harnden <richard.nospam@gmail.invalid> writes:
[...]
> Is there any reason not to always write ...
>
> static const char *s = "hello, world";
>
> ... ?
>
> You get all the warnings for free that way.

The "static", if this is at block scope, specifies that the pointer
object, not the array object, has static storage duration.  If it's at
file scope it specifies that the name "s" is not visible to other
translation units.  Either way, use it if that's what you want, don't
use it if it isn't.

There's no good reason not to use "const".  (If string literal objects
were const, you'd have to use "const" here.)

If you also want the pointer to be const, you can write:

    const char *const s = "hello, world";

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */