[ with big snips of lots of irrelevant stuff ]
On 2026-10-19 17:47, Tim Rentsch wrote:
On 2026-10-18 12:48, David Brown wrote:
The C standards committee collectively reached an agreement counter
to Tim's thoughts, so clearly his preferred variant is /not/
unquestionably better.
My confidence in the collective wisdom of the ISO C committee has
declined in recent years, and sadly for more than just the last
few years. So learning that they have settled (even if that might
change in the future) on the "label: for(...)" approach is
disappointing, but not surprising.
I understand the disappointment when something evolves differently,
where own opinions or own "educated or acquired wisdom" diverges.
(Such expressed disappointment is observable with some other poster
here as well.)
Opinions are fine, arguments are better.
On 2026-10-28 19:59, Tim Rentsch wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
I think people can make an educated decision themselves about
whom they killfile and how they waste their time. ;-)
Please don't make things worse by encouraging the blatherskites.
P.S. For those unfamiliar with the word blatherskite, here is a
partial definition
fir is a blatherskite;
anyone who routinely responds to any blatherskite is a
blatherskite.
Okay, by that definition you primarily named Keith a
"blatherskite".
Chris M. Thomasson pisze:
On 10/27/2026 1:36 PM, fir wrote:
Chris M. Thomasson pisze:Sigh. I just pity you when your access to AI goes off. Say internet
On 10/27/2026 12:42 PM, fir wrote:
[...]
now those clowns appearing like here are really rare ocasins to me
Did they go to the clown school as you?
no - you go to asom school of bulshit with your colegues
then dont expect that normal people who dislike bulshit (as me)
will take it...
ofc for yours alike no-bulshit is some alien think and bulshit is
your home..so you come with buckets full of bulshit here .. drowning
it more and more on poor clc
down. You won't be able to create anymore... Oh well...
its ok but-a i think you could bear your worries in silence.. you can
also pray for me if you want
Rosario19 pisze:
On Mon, 26 Oct 2026 18:06:51 +0100, fir wrote:
bartc pisze:
On 26/10/2026 16:45, fir wrote:1 no divides (by 2 or 3)
bartc pisze:
without or (or something analogic) as i understand if im not wrong >>>>>>> you cantYou seem fixated on that 'or'. Either use 'else', or create 'or' as >>>>>> an alias as I suggested.
2 divides by 2
3 divides by 3
4 divides by 2
5 no divides (by 2 or 3)
6 divides by 2
6 divides by 3
7 no divides (by 2 or 3)
8 divides by 2
9 divides by 3
10 divides by 2
11 no divides (by 2 or 3)
12 divides by 2
12 divides by 3
13 no divides (by 2 or 3)
14 divides by 2
15 divides by 3
16 divides by 2
17 no divides (by 2 or 3)
18 divides by 2
18 divides by 3
19 no divides (by 2 or 3)
if(x%2==0) printf("%d divides by 2\n",x); else goto mod2false;
if(x%3==0) printf("%d divides by 3\n",x); else goto mod2true3false;
goto out;
mod2true3false:
goto out;
mod2false:
if(x%3==0) printf("%d divides by 3\n",x); else mod2false3false;
goto out;
mod2false3false:
printf("%d no divides (by both 3 and 2)\n",x);
out:
but its also bad - you repeat the mod 3 calculation in 2 branches
on assembly level it seem you also need to hold a state but its inner
state can be uin register you dont need name it etc
Dan Cross <> wrote:
In article <>,
Janis Papanagnou <> wrote:
On 2026-10-18 16:13, Michael S wrote:
On Sun, 18 Oct 2026 14:34:28 +0200
Janis Papanagnou <> wrote:
On 2026-10-18 14:09, David Brown wrote:
[...]|e-a (I don't know why N3377 proposed "do { } while NAME ( )" >>>>>> rather than "do NAME { } while ( )". )
Oh! - I can only think that it would then be (sort of) "consistent"
with the place of the label attacked in a 'while' loop; i.e. behind
the 'while' keyword. - It's inconsistent in another interpretation,
though; and I'd certainly have favored the latter form, to have the
label consistently attached at the loop-entry keyword.
I'd prefer label consistently attached to the loop-exit keyword.
I can see that this might look appealing in case of 'break'. In
case of the same mechanism working also for 'continue' I'd then
think that it should generally better be an "attribute" of the
loop entry keyword, i.e. placed where loops start. (But that's
just my opinion.) Having it at a different place with a do-loop
I consider a really bad decision. It's advantageous to know the
direction in which to seek for the label if you inspect code. -
But okay, it's "C"; I won't heat up about some future C-release
that I'll never use (especially given that I'm not even be using
all of those more recent additions that are already available).
I think colocating it with `do` might create a syntactic
ambiguity. In the case of `for`, `while`, and `select`, there
is a required token following the keyword (the `(`). However,
for a `do`/`while` loop, `do` is followed immediately by a,
`secondary-block` production. In particular, you do not _need_
braces to denote a compound statement after `do`; something like
`do i++; while (i < j);` is perfectly legal in C.
In the N3377 proposal, the new `block-name` is just an
identifier. If it were allowed immediately after the `do`, then
given, `do NAME statement; while(condition);` you can't tell
`NAME` from the name of the loop and a random identifier before
a statement; something like `do LOOP i++; while (i < j);`
appears as though it _would_ be be syntactically valid by N3377
as presently worked, but is the programmer's intent to create a
loop name, or should this just be a syntax error?
By requiring the block-name between a keyword and a
syntactically required `(`, you remove that ambiguity: if there
is an identifier there, then it is a `block-name`; if not, then
the block has no name.
AFAICS this is worse, both:
do (i++); while (i < j);
and
do LOOP(i++); while (i < j);
are currently legal (assuming that 'LOOP' is a function).
Writing statement with parentheses may look silly, but such code
may be easily produced due to use of macros.
It due my ignorance of C, I not see all these problem on all this
LoopName for me is easy that is a label
the position of label is inside the {}
as
for(Ini();f();Inc())
{LoopName:
...
if(cond) break LoopName; // would mean just if(cond) goto LoopName;
}
On 13/10/2026 11:26, bart wrote:
On 13/10/2026 11:12, Janis Papanagnou wrote:
On 2026-10-13 09:23, Waldek Hebisch wrote:Because it's a hack. But if this is acceptable, then why does C even
[...]
So what those counts indicate: majority of loops is simple, that
is have no early exit.-a Vast majority of early exits is done
via 'return'.-a "Interesting" loop control is relatively rare.
Checking which 'break'-s are within equivalent of 'switch' would
require manual inspection and that would be too much work.-a But
reasonable guestimate to that there are tens such uses.-a In
a sense that is common, that is significantly more than one
case.-a If my guestimate is correct, then this may be nontrivial
fraction of all uses of 'break'.-a OTOH that is tiny fraction
of all loops.
-aFrom my (personal) perspective, I commonly have two types of
such specific constructs; a very common one is iterating over
options
-a-a while ((opt = getopts (...)) != -1)
-a-a-a-a switch (opt) ...
where, of course, and quite naturally, always the whole loop
is iterated, with no early leaving. And the second common loop
type is those where the switched data comes from the function
as well
-a-a while ((token = parse (...)) != END_TOKEN)
-a-a-a-a switch (token) ...
I'm aware that one might wants to pass and process two values
from a function (as I interpreted one of bart's recent code
fragments), but then, and if it would be "impossible" to avoid
that pattern, I'd just add a condition
-a-a int leaving = 0;
-a-a while ((token = parse (&token...)) != ERROR-a &&-a !leaving)
-a-a-a-a switch (token)
-a-a-a-a-a-a case END_TOKEN: leaving = 1; ...
that's really trivial and straightforward, and it's beyond me
why anyone (but bart, of course) would see a problem here.
have loop-break? Since there is always some workaround (or 'writing
code' as David Brown puts it.)
What would be the consequences of C not having it: would they be
positive or negative overall?
Now apply the same analysis to a hypothetical loop-break that works
inside switch.
You could argue that 'break' is just syntactical sugar for 'goto label'.
If you want to break out of multiple levels, then just use a goto.
Some people have a pathological hatred of 'goto', sure. There's alway a
way to avoid goto, if that's what you really want. That the code, and
it's intention, is clear is the important thing.
I really don't see the issue. It's a style thing at most.
I think for(;;) loop is good because one clear see where are the >initialization part of variable of the loop, the instruction that
break the loop, the change ciclical of variables of the loop
If not so, it is easy emulate the loop in this way
Inizializations
Label: Increment or change varaibles of the loop
Instruction for exit the loop
Instructions
goto label;
It due my ignorance of C, I not see all these problem on all this
LoopName for me is easy that is a label
the position of label is inside the {}
as
for(Ini();f();Inc())
{LoopName:
...
if(cond) break LoopName; // would mean just if(cond) goto LoopName;
}
for(Ini();f();Inc())goto L1;
{
...
if(cond) break LoopName; // would mean just if(cond) goto LoopName;
}
On Tue, 13 Oct 2026 07:23:40 -0000 (UTC), Waldek Hebisch wrote:
So what those counts indicate: majority of loops is simple, that is
have no early exit. Vast majority of early exits is done via
'return'.
My experience in my own C code is quite the opposite. Lots of loops
have exits in the middle, leading me to use forms like rCLfor (;;)rCY. I
also try to avoid putting rCLreturnrCY anywhere other than the end of a >function, to make it easier to see the flow of control.
*cough* Nassi-Shneiderman diagrams *cough*
On 13/10/2026 01:33, Keith Thompson wrote:
bart <bc@freeuk.com> writes:
[...]
This is my first example expressed in C (note those first three args
are passed by reference):
while (pmtype = nextcmdparam(¶mno, &name, &value, "m") {
switch (pmtype)
case pm_option: ...; break;
case pm_sourcefile:
if (passlevel == run_pass || passlevel == runpcl_pass) {
break;
Except I can't use break like that. So I have to find a workaround.
The code appears to be valid C that doesn't do what you want. I can't
easily tell what you want it to do. I don't know which of the two break
statements was intended to break out of the loop. A comment would have
solved that.
I'm going to guess that the first break is supposed to apply to the
switch statement, and the second to the while loop.
You want the language to be changed to make this kind of thing easier.
That's already happening. If you take a look at the N3886 working
draft for C2y, it has named break statements. In C2y (or in gcc
if you use an extension), the above could be written as:
WHILE:
while (pmtype = nextcmdparam(¶mno, &name, &value, "m") {
SWITCH:
switch (pmtype)
case pm_option: ...; break SWITCH;
case pm_sourcefile:
if (passlevel == run_pass || passlevel == runpcl_pass) {
break WHILE;
assuming it's the second "break' that's supposed to break out of
the loop. (I'd probably use more meaninful names.)
There is already a solution for the problem you're complaining about.
(It also solves the problem of breaking out of nested loops.)
If you're unable to use this feature, you can use goto. That's not
ideal, but with well chosen label names and no backward branching
it's not too bad.
I've got a better idea. I added an extra keyword to my C compiler called >"breakloop". It's like 'break' but always works with the nearest
enclosing loop, even from inside switch.
So this example (a starts at 0):
while (1) {
switch (a++) {
case 1: puts("one"); break;
case 2: puts("two"); breakloop;
case 3: puts("three"); break;
default: puts("other");
}
if (a>40) break;
}
finishes after displaying 'two', instead of after the 37th or so 'other'.
Modding the compiler took 90 seconds, and needed 4 extra lines of code. >Setting up this test took 2-3 minutes.
Simple, yes? Then you think that this could be done even more easily 50 >years ago.
On Wed, 14 Oct 2026 00:21:00 +0100, bart wrote:
On 13/10/2026 01:33, Keith Thompson wrote:
bart <bc@freeuk.com> writes:
[...]
This is my first example expressed in C (note those first three args
are passed by reference):
while (pmtype = nextcmdparam(¶mno, &name, &value, "m") {
switch (pmtype)
case pm_option: ...; break;
case pm_sourcefile:
if (passlevel == run_pass || passlevel == runpcl_pass) { >>>> break;
Except I can't use break like that. So I have to find a workaround.
The code appears to be valid C that doesn't do what you want. I can't
easily tell what you want it to do. I don't know which of the two break >>> statements was intended to break out of the loop. A comment would have
solved that.
I'm going to guess that the first break is supposed to apply to the
switch statement, and the second to the while loop.
You want the language to be changed to make this kind of thing easier.
That's already happening. If you take a look at the N3886 working
draft for C2y, it has named break statements. In C2y (or in gcc
if you use an extension), the above could be written as:
WHILE:
while (pmtype = nextcmdparam(¶mno, &name, &value, "m") {
SWITCH:
switch (pmtype)
case pm_option: ...; break SWITCH;
case pm_sourcefile:
if (passlevel == run_pass || passlevel == runpcl_pass) {
break WHILE;
assuming it's the second "break' that's supposed to break out of
the loop. (I'd probably use more meaninful names.)
There is already a solution for the problem you're complaining about.
(It also solves the problem of breaking out of nested loops.)
If you're unable to use this feature, you can use goto. That's not
ideal, but with well chosen label names and no backward branching
it's not too bad.
I've got a better idea. I added an extra keyword to my C compiler called
"breakloop". It's like 'break' but always works with the nearest
enclosing loop, even from inside switch.
So this example (a starts at 0):
while (1) {
switch (a++) {
case 1: puts("one"); break;
case 2: puts("two"); breakloop;
case 3: puts("three"); break;
default: puts("other");
}
if (a>40) break;
}
finishes after displaying 'two', instead of after the 37th or so 'other'.
Modding the compiler took 90 seconds, and needed 4 extra lines of code.
Setting up this test took 2-3 minutes.
Simple, yes? Then you think that this could be done even more easily 50
years ago.
would be equivalent to
%define breakloop goto
while (1) {
goto L1;
LoopName: break;
L1:
switch (a++) {
case 1: puts("one"); break;
case 2: puts("two"); breakloop LoopName;
case 3: puts("three"); break;
default: puts("other");
}
if (a>40) break;
}
On Tue, 13 Oct 2026 21:54:06 -0000 (UTC), Lawrence D|+Oliveiro <>
wrote:
On Tue, 13 Oct 2026 07:23:40 -0000 (UTC), Waldek Hebisch wrote:
So what those counts indicate: majority of loops is simple, that
is have no early exit. Vast majority of early exits is done via
'return'.
My experience in my own C code is quite the opposite. Lots of loops
have exits in the middle, leading me to use forms like rCLfor (;;)rCY.
I also try to avoid putting rCLreturnrCY anywhere other than the end of
a function, to make it easier to see the flow of control.
*cough* Nassi-Shneiderman diagrams *cough*
my little experience is this for simple task loop are simple and
this is 95% of times than there algo need goto label for optimal
construction in terms of speed or number of execution statements
%define breakloop goto
On 2026-10-28 20:02, Tim Rentsch wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
On 2026-10-28 00:00, Dan Cross wrote:
In some article, Dan Purgert <dan@djph.net> wrote:
On 2026-10-27, Richard Harnden wrote:
On 27/10/2026 21:25, Chris M. Thomasson wrote:
On 10/27/2026 1:49 PM, fir wrote:
[...]
I can see it now. Somebody hires you as their graphics guy.
They say go at it. You ask well, where is the AI, you get fired >>>>>>> on the same day?
The lazy/incoherent way fir writes ... I can't see his CV getting
past the AI vetting stage.
It's okay, he used AI.
But seriously though why can't he use AI for his spelling and
grammar.
Why doesn't he communicate completely and exclusively with an AI
instead of posting in newsgroups, spouting gibberish at humans.
(An AI appears to be the perfect communication partner for that
individual! One could even think that AIs have been developed for
exactly this kind of clients in mind.)
PS: Related question: Why do some folks here play the role of the
AI and continuously feed him.
Why do you make things worse by encouraging further pointless
discussion?
[...]
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
My understanding is you have decided not to read my postings
so it seems better not to respond further.
On 2026-10-28 00:00, Dan Cross wrote:
In article <slrn11e2aa4.2i9.dan@djph.net>, Dan Purgert-a <dan@djph.net>
wrote:
On 2026-10-27, Richard Harnden wrote:
On 27/10/2026 21:25, Chris M. Thomasson wrote:
On 10/27/2026 1:49 PM, fir wrote:
[...]
I can see it now. Somebody hires you as their graphics guy. They
say go
at it. You ask well, where is the AI, you get fired on the same day?
The lazy/incoherent way fir writes ... I can't see his CV getting past >>>> the AI vetting stage.
It's okay, he used AI.
But seriously though why can't he use AI for his spelling and
grammar.
Why doesn't he communicate completely and exclusively with an AI
instead of posting in newsgroups, spouting gibberish at humans.
(An AI appears to be the perfect communication partner for that
individual! One could even think that AIs have been developed for
exactly this kind of clients in mind.)
Janis
PS: Related question: Why do some folks here play the role of the
AI and continuously feed him.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 76 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 57:39:27 |
| Calls: | 1,265 |
| Calls today: | 1 |
| Files: | 1,362 |
| D/L today: |
4 files (9,632K bytes) |
| Messages: | 285,926 |