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 <868qyaaab0.fsf@linuxsc.com>
Deutsch   English   Français   Italiano  
<868qyaaab0.fsf@linuxsc.com>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups: comp.lang.c
Subject: Re: question about nullptr
Date: Tue, 09 Jul 2024 07:50:59 -0700
Organization: A noiseless patient Spider
Lines: 69
Message-ID: <868qyaaab0.fsf@linuxsc.com>
References: <v6bavg$3pu5i$1@dont-email.me> <20240706054641.175@kylheku.com> <v6bfi1$3qn4u$1@dont-email.me> <l9ciO.7$cr5e.2@fx05.iad> <877cdyuq0f.fsf@bsb.me.uk> <2ckiO.19403$7Ej.4487@fx46.iad> <87plrpt4du.fsf@bsb.me.uk> <9bCiO.7108$sXW9.3805@fx41.iad> <877cdwu9s1.fsf@nosuchdomain.example.com> <20240708222804.00001654@yahoo.com> <v6hotk$11nib$2@dont-email.me> <20240709104848.00005732@yahoo.com> <86cynmajh9.fsf@linuxsc.com> <20240709155014.000039d0@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Tue, 09 Jul 2024 16:51:00 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="4404f50b61bba69374b6468dfb9554fc";
	logging-data="1499591"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18bnKxaGJB3AaGOQFOkHlR3zK6P5meBvl4="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:/NMK4stc7Hc682U9rATJ7S/rHS0=
	sha1:VgBg4eMrzog8FfEtUCuNzDdjwXo=
Bytes: 3963

Michael S <already5chosen@yahoo.com> writes:

> On Tue, 09 Jul 2024 04:32:50 -0700
> Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
>
>> Michael S <already5chosen@yahoo.com> writes:
>>
>>> On Mon, 8 Jul 2024 15:23:47 -0700
>>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> wrote:
>>>
>>>> On 7/8/2024 12:28 PM, Michael S wrote:
>>>>
>>>>> On Sun, 07 Jul 2024 15:17:34 -0700
>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>>
>>>>>> I just about always use NULL, not 0, when I want a null pointer
>>>>>> constant.  Similarly, I use '\0', not 0, when I want a null
>>>>>> character, 0.0 when I want a floating-point zero, and false when
>>>>>> I want a Boolean zero.  I just like being explicit.
>>>>>
>>>>> Pointer:  I very rarely use NULL.
>>>>> Character:  I never use '\0'.
>>>>
>>>> Not even something like:
>>>>
>>>> #define CLINE 128
>>>>
>>>> char x[CLINE] = { '\0' };
>>>>
>>>> ?
>>>>
>>>> ;^)
>>>
>>> I see nothing special about your case. {0} is the most appropriate.
>>
>> Any use of '\0' almost always strikes me as an affectation.  It's
>> like people want to somehow pretend that it's not the same as
>> just 0.
>>
>>> And, BTW, I never use #define for integer constants.
>>
>> What do you do if you need to define a compile-time constant
>> whose value is outside the range of signed int?  With the
>> understanding that the context is C as it is now, and not
>> C++ or some imagined other language.
>
> In comment above "integer constant" meant "within the range of signed
> int".  But let's accept more general meaning.  Then, when it happens, I
> have a problem and forced to flex my principles :(
> Luckily, it's pretty rare.  I mean, it's pretty rare that the constant
> is both outside the range of signed int and I really really have to
> have it as compile-time constant.

I agree it's not common.  I was just wondering what you would
do if it came up (and as it happens it did come up for me
recently, and I used a #define rather than trying to find an
alternative).

> More often big numbers like these are
> used in arithmetic/logic, so 'const wide_type' or 'static const
> wide_type' is practically as good as a "real" compile-time constant
> despite being "less constant" in theory.

I routinely use initialized ordinary variables rather than
other methods, when the variables work.  Incidentally, IME
the results are better with automatic variables rather than
static.  For arrays or structs, static might be better, but
for simple scalar values I normally use ordinary automatics
rather than statics.