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 connectionsPath: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson
Newsgroups: comp.lang.c
Subject: Re: C23 thoughts and opinions
Date: Mon, 03 Jun 2024 16:23:57 -0700
Organization: None to speak of
Lines: 56
Message-ID: <87le3l1ugi.fsf@nosuchdomain.example.com>
References:
<20240602124448.704@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Tue, 04 Jun 2024 01:23:57 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="90afdb6d92dd2740ec1db4216de117c0";
logging-data="103375"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oi6d+l2Vn8hirsYqng2Ot"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:IaoUjvLty/+K8LlJMMx6vHLDy/E=
sha1:aLuAdF5P5c47ebUKZ4ELepvQdMs=
Bytes: 2970
bart writes:
[...]
> At this point someone will suggest a macro this:
>
> #define forever for(;;)
When I was first learning C, I defined a macro, something like:
#define ever ;;
so that I could write
for (ever) {
/* ... */
}
At the time, I thought it was very clever.
I still think it was very clever. But I no longer think that's a
good thing.
> All that suggest sto me is that the language *needs* an explicit
> endless loop!
No, it doesn't.
There are multiple valid and idiomatic ways to write an infinite
loop in C:
for (;;)
while (1)
while (true) // requires C99 or later and #include ,
// or C23 or later without the #include,
// or your own "true" macro.
There is nothing wrong with any of them. All C programmers should
immediately recognize each of them as an infinite loop. The compiler
might have to do a few different things internally to process each
one -- and that makes no difference to me as a programmer. If a
compiler generated different code for different forms, I probably
wouldn't notice. If I bothered to check, I'd be mildly curious
about the reasons, and annoyed if one form was more efficient.
A language designed from the beginning with syntactic and semantic
elegance in mind might have only one explicit form of infinite loop
(though something like "while (true)" or "while (1+1==2)" would
still be allowed). C is not that language.
I suspect some of the people in this thread saying that one form
is obviously better than the others are joking.
It doesn't matter.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */