The other was C. There, several choices were made:
* To start with that Fortran style except that [] are used
* To decree that that 'A[20]' syntax is supposed to match indexing of
˙ A as it might appear in an expression
* To introduce "*" as a prefix dereference operator in expressions ...
* ... which then means that a prefix "*" appears in the declaration too
* A further complication was to allow function pointers within that a
˙ declaration list
* Yet one more which came later was to add 'const', where placement now
˙ gets confusing
But to stay with pointers, take this expression:
˙˙ *A[i]
C precedence rules mean this is parsed as *(A[i]), which means that a
type written as 'T *A[N]' must be an array of pointers to T (I had to
think for a few seconds!).
But suppose you wanted a pointer to array of T? The expression for that would be:
˙˙˙ (*A)[i]
And so the declaration has to be 'T (*A)[N]' too.
So it is unfortunate that parentheses used to control precedence in an expression now also have to appear in type declarations (where they are often next to () used for parameter lists, for further confusion).
==============================================
So, what would have happened with a postfix deref op? (Ignore whether
'*' would still be a good choice.) My first example would be this:
˙˙ A*[i]
Here, it would mean that A is dereferenced, then indexed; A must then be
a pointer to an array of T.
But suppose we wanted the original array of pointers to T, where you
index first then dereference. That is written like this:
˙˙ A[i]*
You simply swap the order of [] and *.
So, PARENTHESES HAVE BEEN ELIMINATED for purpose of disambiguating array/pointer and pointer/array, both within expressions and within type-declarations.
How about that? Further, most of the type-spec is now LTR; only the base-type has to stay on the left. Access terms in expressions will be
fully LTR.
IMO C suffers because typedef was added late in the game and
function prototypes are much later.˙ Prototypes need types and
to get it one needs "hole" in variable declaration.˙ Where the
hole should be is specified by the C syntax, but placement of
hole is probably least clear aspect of declarations.
I thought that 'hole' was where 'int A[10]' mean one thing in normal declaration but another within a parameter list.
IMO C declaration syntax was a mistake, but as real life shows
it was not a fatal mistake, people can adapt.
A mistake that could so easily have been avoid by choosing a different precedence as shown above. Did none of the thousand people working at
Bell Labs (according to a comment in DC's follow-ip) spot this and say anything?
Had no-one even glanced at a Pascal spec, if there was no working copy?
It would have transformed C type syntax.
(ACTUALLY IT IS NOT TOO LATE. A secondary postfix deref op could have
been added. This could have been done 50 years ago, with the original eventually deprecated.
But this is a common theme of mine whether I perceive a problem that
people grudgingly admit might not be idea. But nothing was ever done to
fix it even after decades.)
On 2026-10-20 10:25, David Brown wrote:
On 19/10/2026 23:27, Janis Papanagnou wrote:
On 2026-10-19 21:35, Michael S wrote:
[...]
I'm sorry, these are (AFAICT) common terms, and I thought obvious.
I am afraid your terminology is further from common use than you thought.
I'm afraid you are wrong here; in several ways. I'll expand below.
On 20/10/2026 09:01, David Brown wrote:
On 19/10/2026 23:28, bart wrote:
(Funny that when I suggest that nested loop breaks are uncommon,
everyone says I'm wrong! Some even write 200-line made-up examples to
prove their point.)
I don't remember "everyone" saying you were wrong to say that nested
loop breaks are uncommon - in fact, I don't remember /anyone/ saying
that was wrong.
(There was a LOT of antipathy towards my idea to fix the common case of >'loop-break' clashing with 'switch-break', BECAUSE it did not fix the >problem of nested loop-break, which is uncommon, even though that wasn't
the aim.)
There is no reason to abstract away that function pointer type.
You probably do so in C /because/ the type involves * () and [] but
have somehow persuaded yourself that it just better that way.
Do you hear that whooshing noise?˙ It is the sound of the point flying
far above your head.
Here is an example of some sensible function typedefs, all from third-
party code (so not my "peculiar" style)
typedef void (*TimerCallbackFunction_t)( TimerHandle_t xTimer );
TimerHandle_t xTimerCreate(˙ const char * const pcTimerName,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ TickType_t xTimerPeriodInTicks,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ UBaseType_t uxAutoReload,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ void * pvTimerID,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ TimerCallbackFunction_t pxCallbackFunction );
typedef void (*lwip_thread_fn)(void *arg);
typedef void (*tcpip_init_done_fn)(void *arg);
typedef void (*tcpip_callback_fn)(void *ctx);
typedef void (* sys_timeout_handler)(void *arg);
typedef void (*dns_found_callback)(const char *name,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ const ip_addr_t *ipaddr, void *callback_arg);
This is the kind of C I find hard to read. There are lots of typedefs
but few uses of those typedefs that I can see, so I don't know how much >difference they make.
[snip]
I've left in the regular parameter names, even though C doesn't need
them, but they are quite heavy - you don't really need those
Hungarian-style prefixes.)
Well, I guess this buys you one thing: the parameter name for the last >parameter is to the right of its type, rather than be inside it. But a C >expert should not be fazed by that.
Here is the same function as I might write it in an alternative syntax.
I've kept the same names, but changed case-style and removed prefixes
and suffixes. I've capitalised user-type names:
func TimerCreate( # (retain case if FFI import)
ichar timername,
Ticktype timerperiodinticks,
Ubasetype autoreload,
ref void timerid,
ref proc(Timerhandle) callbackfn)
In this form, it's hard to see what benefit a typedef would give for
that last parameter; it is simple enough.
Ask yourself why the typedefs are used.˙ Look at the /names/.˙ Those
last four are all from the same network stack library, and are all
typedefs for "void (*)(void*)".
Until you mentioned it, I hadn't noticed. So typedef has done a good job
of hiding that useful fact! But looking more closely, it is the first
four of the last five.
Let's take one:
typedef void (*lwip_thread_fn)(void *arg);
That 'arg' is not much use for a start (other than being a hint that
this particular (...) is where the parameters go).
So, maybe this is used like this:
void F(lwip_thread_fn lwip_thread_callback);
Here you have two identifiers imparting the sort kind of information; a >tautology.
If that function pointer pattern is common, or recurs in a suite of >functions, I might also have used a typedef, but with a common name.
Then only one would be needed, say:
typedef void (*stack_callbackfn)(void);
I might have done the same in that alternate syntax as it would start to
get cluttery: 'ref proc(ref void)', but also in order to define that
common pattern in one place.
Note that 'pcl' in my example /is/ a typedef; here it makes sense as
it is used in 100s of places. This function pointer occurs in only one
place.
I'm sorry, I had mistaken you for a programmer who wanted to write good,
clear programs.˙ Naming things is not a shortcut to save keypresses.
Isn't that one of the main uses of typedefs? So as to give a handy, >'euphonious' one-token alias to an elaborate typedef.
It also allows you to change the type in one place without having to
update hundreds of instances.
It also allows the type to be opaque.
Saving keypresses is bonus benefit, but if it is shorter, then it can
also help readability as other critical elements are not overshadowed.
So I'm not sure what objection you have to this particular use of it.
Here is the one place I do remember using typedef for a function pointer >(from an old project, not in C):
type fnptr = ref proc
repeat
(fnptr(pcptr^))^()
until stopped
It's used as a cast, but reason I have it is because with simple cast >syntax, which is 'T(X)', the meaning without it would be ambiguous (a >grammar issue that I might fix one day).
Rather than fallback to standard cast syntax (which is 'cast(X, T)'),
this was tidier.
BTW what name would be given to such a function pointer type?
I have no idea what your code is supposed to do,
It's a table of function pointers! All sharing the same signature.
That's pretty generic. Is it really that hard to guess? You don't need
to know what they do, other than at some point they will be called as >handlertable[i](arg).
Rust implementation of Timers, mentioned above<--
On 20/10/2026 16:11, bart wrote:
The other was C. There, several choices were made:
* To start with that Fortran style except that [] are used
* To decree that that 'A[20]' syntax is supposed to match indexing of
˙˙ A as it might appear in an expression
* To introduce "*" as a prefix dereference operator in expressions ...
* ... which then means that a prefix "*" appears in the declaration too
* A further complication was to allow function pointers within that a
˙˙ declaration list
I don't see a problem with that.˙ If you need to declare a function
pointer, you need to declare it in a declaration list.
To me, the big disadvantage of C's declaration syntax is that it lets
you declare things of different (but related) types in the same
declaration.
or, more common and therefore worse :
˙˙˙˙int * a, b;
I was going to say it was right-to-left, but it can be considered both* Yet one more which came later was to add 'const', where placement now
˙˙ gets confusing
Some people do find it hard to understand the difference between :
˙˙˙˙const int * p;
˙˙˙˙int * const q;
˙˙˙˙const int * const r;
I note that this is despite the clear left-to-right nature of "const" here.
Complicated types are a minority.
So, PARENTHESES HAVE BEEN ELIMINATED for purpose of disambiguating
array/pointer and pointer/array, both within expressions and within
type-declarations.
Agreed.
But does that make a significant difference?˙ I don't think so.
A mistake that could so easily have been avoid by choosing a different
precedence as shown above. Did none of the thousand people working at
Bell Labs (according to a comment in DC's follow-ip) spot this and say
anything?
I suspect the folks at Bell Labs were too busy writing real code to be bothered by how confused you would be with artificially complex types.
(ACTUALLY IT IS NOT TOO LATE. A secondary postfix deref op could have
been added. This could have been done 50 years ago, with the original
eventually deprecated.
It /is/ too late - far, far too late.˙ It would be a terrible idea to
add a new postfix dereference operator to give two different operators
with no benefit other than very occasionally reducing the need for parentheses.
In article <11b7k22$2v8e5$1@dont-email.me>, bart <bc@freeuk.com> wrote:
The point is that the name you chose is meaningless to anyone
other than you. What's a PCL? Phase Control Line? Printer
Command Language? Photon Compressor Loop?
Here is the one place I do remember using typedef for a function pointer
(from an old project, not in C):
type fnptr = ref proc
repeat
(fnptr(pcptr^))^()
until stopped
More generally, I fail to see what this is trying to
demonstrate.
On 20/10/2026 02:03, Waldek Hebisch wrote:
bart <bc@freeuk.com> wrote:
OK. But they HAD to create C? There were quite a few languages in
the early 70s too: like Pascal, Fortran, PL/I, Coral-66, plus of
course BCPL and B. So why a new one?
You ignore fact that Ritche wanted reasonably fast code from
very simple compiler.
According to DC's quote from HOPL, it was also more fun to create a
new language.
PL/I had most needed features. But PL/I was a big language,
to run on small machine they would have to take tiny subset
and then add extentions. Basicaly they would end up with a
language which is very far from PL/I.
There were PL/360 and PL/M, although those were more specific, more 'machine-oriented' languages. (I implemented one for PDP10 but it was
a port of a systems language from a GEC machine.)
Anyway, a more general subset could have been used.
Similarly, BCPL was too complicated, B and C were simplifications
and adaptations small machine.
I think that Pascal was too late: nominally it was created earlier
but I think that it was available to Bell Labs only after they
did initial work leading to C. And Pascal shared problem of
speed on small machines. Note that later UCSD Pascal which
run on micros compiled to interpreted bytecode, which significantly
reduced performance.
It would not have been hard to use Pascal as a starting point for a
workable systems language. Wirth wouldn't have approved, but his
languages were too pure, too academic; some of us had things we
needed to get done!
Here I mean adapting Pascal for a competing systems language.
In my hands some aspects would be simplified (eg. no nested
functions, no closures), thus making it easier to generate decent
code with a simple compiler.
FORTRAN syntax looked nothing like C! Unless you mean the general
pattern of 'INTEGER A, B' which was shared by half of all
languages.
I think more pattern of
INTEGER A(20), B
which has similar structure to C variable declarations.
OK. That was typical for the time. But in Fortran it didn't get much
more complicated than that. Maybe 2D arrays and so on.
Of course,
FORTRAN had no pointers (and structures or unions), so Ritche had
to invent syntax for them.
There were three languages from that era that I know had pointers or references, and which allowed composing arbitrary types with arrays
and pointers, two of which were Algol68 and Pascal.
Both used a 100% LTR form.
The other was C. There, several choices were made:
* To start with that Fortran style except that [] are used
* To decree that that 'A[20]' syntax is supposed to match indexing of
A as it might appear in an expression
* To introduce "*" as a prefix dereference operator in expressions ...
* ... which then means that a prefix "*" appears in the declaration
too
* A further complication was to allow function pointers within that a
declaration list
* Yet one more which came later was to add 'const', where placement
now gets confusing
But to stay with pointers, take this expression:
*A[i]
C precedence rules mean this is parsed as *(A[i]), which means that a
type written as 'T *A[N]' must be an array of pointers to T (I had to
think for a few seconds!).
But suppose you wanted a pointer to array of T? The expression for
that would be:
(*A)[i]
And so the declaration has to be 'T (*A)[N]' too.
So it is unfortunate that parentheses used to control precedence in
an expression now also have to appear in type declarations (where
they are often next to () used for parameter lists, for further
confusion).
==============================================
So, what would have happened with a postfix deref op? (Ignore whether
'*' would still be a good choice.) My first example would be this:
A*[i]
Here, it would mean that A is dereferenced, then indexed; A must then
be a pointer to an array of T.
But suppose we wanted the original array of pointers to T, where you
index first then dereference. That is written like this:
A[i]*
You simply swap the order of [] and *.
So, PARENTHESES HAVE BEEN ELIMINATED for purpose of disambiguating array/pointer and pointer/array, both within expressions and within type-declarations.
How about that? Further, most of the type-spec is now LTR; only the base-type has to stay on the left. Access terms in expressions will
be fully LTR.
IMO C suffers because typedef was added late in the game and
function prototypes are much later. Prototypes need types and
to get it one needs "hole" in variable declaration. Where the
hole should be is specified by the C syntax, but placement of
hole is probably least clear aspect of declarations.
I thought that 'hole' was where 'int A[10]' mean one thing in normal declaration but another within a parameter list.
IMO C declaration syntax was a mistake, but as real life shows
it was not a fatal mistake, people can adapt.
A mistake that could so easily have been avoid by choosing a
different precedence as shown above. Did none of the thousand people
working at Bell Labs (according to a comment in DC's follow-ip) spot
this and say anything?
Had no-one even glanced at a Pascal spec, if there was no working
copy? It would have transformed C type syntax.
(ACTUALLY IT IS NOT TOO LATE. A secondary postfix deref op could have
been added. This could have been done 50 years ago, with the original eventually deprecated.
But this is a common theme of mine whether I perceive a problem that
people grudgingly admit might not be idea. But nothing was ever done
to fix it even after decades.)
On 20/10/2026 20:24, Dan Cross wrote:
In article <11b7k22$2v8e5$1@dont-email.me>, bart <bc@freeuk.com> wrote:
The point is that the name you chose is meaningless to anyone
other than you. What's a PCL? Phase Control Line? Printer
Command Language? Photon Compressor Loop?
Within the context of that application then it would be clear. You're
just being overly hostile.
(Within the app, PCL is the name of a bytecode language, and 'pcl' is a >reference to a specific instruction.
Next time I'll just use T for such examples, since the type is not
relevant to the point. Although that didn't stop you seizing upon my F >function.)
Here is the one place I do remember using typedef for a function pointer >>> (from an old project, not in C):
type fnptr = ref proc
repeat
(fnptr(pcptr^))^()
until stopped
More generally, I fail to see what this is trying to
demonstrate.
Not much. It is just a rare example of my using aliases for function >pointers. Because I suggested such aliases are often unnecessary and
partly used in C to get around the fiddly type syntax that would arise.
In article <11b8j17$3btus$1@dont-email.me>, bart <bc@freeuk.com> wrote:
On 20/10/2026 20:24, Dan Cross wrote:
In article <11b7k22$2v8e5$1@dont-email.me>, bart <bc@freeuk.com> wrote:
The point is that the name you chose is meaningless to anyone
other than you. What's a PCL? Phase Control Line? Printer
Command Language? Photon Compressor Loop?
Within the context of that application then it would be clear. You're
just being overly hostile.
Not really. You are, I presume, posting that code to try and
make some kind of point about how "readable" it is. But it's
not readable unless you already know what it does.
On the other hand, the code David posted _is_ readable, because
it uses the language to encode domain-specific information into
type names.
Yeah, you really just don't get it.One of us doesn't get it.
On Tue, 20 Oct 2026 15:11:35 +0100
bart <bc@freeuk.com> wrote:
I suppose that you wholeheartedly agree. I don't. I never found computer language design fun.
Methinks there were less than 100 people exposed to C before it became
too late. May be, just 50.
Had no-one even glanced at a Pascal spec, if there was no working
copy? It would have transformed C type syntax.
(ACTUALLY IT IS NOT TOO LATE. A secondary postfix deref op could have
been added. This could have been done 50 years ago, with the original
eventually deprecated.
But this is a common theme of mine whether I perceive a problem that
people grudgingly admit might not be idea. But nothing was ever done
to fix it even after decades.)
It was. There are many new languages.
Today, C sees little use outside of small to mid-sized mocrocontrollers
and OS kernels.
Most user-layer applications on general purpose computers are written
in newer languages.
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
antispam@fricas.org (Waldek Hebisch) writes:
Lawrence D?Oliveiro <ldo@nz.invalid> 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 ?for (;;)?. I
also try to avoid putting ?return? anywhere other than the end of a
function, to make it easier to see the flow of control.
Well, usually there is a lot of loops. Those with exit in the
middle are still significant.
Concernig 'return', having it in place where all work inside function
is done help me to see flow control and avoids complications. In
case of search functions it means return from the middle of the loop.
IMO possible alternatives like flag variables or break and retrun
after loop are worse.
I rarely use 'break' to exit a loop. Part of this is that I try to
write standard loops so that they complete as part of the loop test
(i.e., in while() or for() control expressions). That isn't the
whole story though so let me talk about 'return'.
I counted various constructs in a small suite of 2 programs (1306
lines in 3 files). There are 4 breaks outside switches and 32
loops in total. My gut feeling is that this proportion is
reasonable close to typical in my code. For comparison, there
are 67 functions and 70 'if'-s.
Most of the functions I write have exactly one return, at the end of
the function. I estimate this pattern accounts for around 85% of
all functions, let's say plus or minus 5%.
In code above about half of functions is 'void' and there are 34
explicit returns (of which at least 2 are early returns).
Sometimes functions have early returns for errors or exceptional
conditions.
Code above contains 16 occurences of 'exit(1)'. One of those is
in a macro that is used 10 times, so actually there are 25 places
which call 'exit(1)'. That is related to the programs being
simple utilities, there is no attempt to error recovery, on error
programs simply print error message and exit.
Early returns are easily seen to lie outside the main
body of function processing so they don't interfere with
understanding what the rest of the function is doing or how it
works.
A fairly common sub-pattern are functions most of whose body is a
switch() statement, with all of the switch() cases being a simple
return.
Code above has 2 switches, both are in parsing functions, where
cases either move to next state or signal error. Parsing functions
also open file and close it when finished and return data structure
with parsed info.
It does sometimes happen that a function will have a loop with a
return in the middle, and also a return at the end for what to do if
the loop terminates. To me having an in-loop return looks better
than using an assignment and a break.
A fairly rare but important pattern is what I might call vectoring
or decomposition. Here the function body serves to distinguish and
separate out different regimes of subprocessing. To continue
processing in a particular regime, a return is used not to directly
yield a value but rather to call a further function to handle that
sub-domain. The benefit here is both to keep function bodies small
and to allow re-use of commonly called sub-functions.
Two aspects are important for having these different styles work
together. One is that it's easy to distinguish the different kinds
of patterns, and by far the most simple pattern is the most common.
The other is to be sure to keep function bodies small. Keeping
function bodies small goes a long way in making them easy to
understand, which obviously is a key property in writing good code.
Also keeping function bodies small effectively prevents mixing
different styles in a single function, serving to reinforce point
one.
I think that in general my C code has similar characteristics.
But
let me note that while I have a lot of small functions, I also have
some which are bigger. I suspect that 10% or more of my code is
in functions that are bigger then 30 lines. Such functions
frequently have several variables and there is setup stage to
initialize things, actual processing and final part (cleanups,
possibly extraction of result). Stages are clearly sepatated
by their position inside function, OTOH are strongly coupled due
to use of variables. My feeling here is that in case of strongly
coupled code with no reusable parts keeping it inside single
function is more managable than trying to split it into smaller
functions.
Without typedef's, that function signature would be something like :
signed char dns_gethostbyname(const char *hostname, struct ip_addr
*addr, void (*found)(const char *name, const struct ip_addr
*ipaddr, void *callback_arg), void *callback_arg);
On 20/10/2026 22:44, Dan Cross wrote:
In article <11b8j17$3btus$1@dont-email.me>, bart <bc@freeuk.com> wrote:
On 20/10/2026 20:24, Dan Cross wrote:
In article <11b7k22$2v8e5$1@dont-email.me>, bart <bc@freeuk.com> wrote: >>>
The point is that the name you chose is meaningless to anyone
other than you. What's a PCL? Phase Control Line? Printer
Command Language? Photon Compressor Loop?
Within the context of that application then it would be clear. You're
just being overly hostile.
Not really. You are, I presume, posting that code to try and
make some kind of point about how "readable" it is. But it's
not readable unless you already know what it does.
What it does not relevant. This is simply defining an array of T. But >because T happens to be a function pointer, DB insists that an alias
must be created, and a new name invented.
Why? Probably because in C, the syntax for function pointers gets hairy.
On the other hand, the code David posted _is_ readable, because
it uses the language to encode domain-specific information into
type names.
Maybe we should create aliases for function signatures more often then,
then we can encode that extra info.
So that instead of, for example:
void SomeFunc(int x, int y) {printf("%d %d\n", x, y);}
you do:
typedef void Take2Ints(int x, int y);
Take2Ints SomeFunc {printf("%d %d\n", x, y);}
If you have a suite of functions sharing the signature, then it might be
a good idea. But funnily enough, you never see this being done.
(I don't know if this is legal C; but it works fine with my compiler:
c:\m>type fred.c
#include <stdio.h>
typedef void Take2Ints(int x, int y);
Take2Ints SomeFunc{printf("%d %d\n", x, y);}
int main(void) { SomeFunc(10, 20); }
c:\m>bcc -r -q fred
10 20
)
Yeah, you really just don't get it.
One of us doesn't get it.
On 20/10/2026 13:41, bart wrote:
But let us take a concrete example.˙ These network functions are from
the LWIP network stack, which is designed to be used on small embedded systems that may not have any kind of OS - so it uses call-backs for asynchronous programming.
An example API function is this :
err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ dns_found_callback found, void *callback_arg)
The returned "err_t" can be "ERR_OK" (indicating the "hostname" is in
the DNS cache and *addr is set to the IP), "ERR_ARG" for argument
errors, or "ERR_INPROGRESS" to indicate that the stack is looking up the
DNS name, and will call the callback when there is a final result or timeout.
Without typedef's, that function signature would be something like :
signed char dns_gethostbyname(const char *hostname, struct ip_addr
˙˙˙˙*addr, void (*found)(const char *name,˙˙˙ const struct ip_addr
˙˙˙˙*ipaddr, void *callback_arg), void *callback_arg);
Do you expect anyone to believe you if you claim this is easier to read
than the real declaration using typedefs?˙ I'll believe you if you say
you find the original hard to read - but not if you claim the
"untypedef'ed" version is clearer.
On 19/10/2026 23:27, Janis Papanagnou wrote:[...]
˙ * a b˙˙˙˙ PN (Polish Notation)
There is no term "Polish Notation" - except as occasionally used to
mean /postfix/ as a short form of "Reverse Polish Notation". RPN was invented, or at least popularised, by the Polish logician Jan
?ukasiewicz (I admit to looking that up on Wikipedia!). There is no
"PN" opposite.
In article <11b8qqg$3ejlp$1@dont-email.me>, bart <bc@freeuk.com> wrote:
On 20/10/2026 22:44, Dan Cross wrote:
In article <11b8j17$3btus$1@dont-email.me>, bart <bc@freeuk.com> wrote: >>>> On 20/10/2026 20:24, Dan Cross wrote:
In article <11b7k22$2v8e5$1@dont-email.me>, bart <bc@freeuk.com> wrote: >>>>
The point is that the name you chose is meaningless to anyone
other than you. What's a PCL? Phase Control Line? Printer
Command Language? Photon Compressor Loop?
Within the context of that application then it would be clear. You're
just being overly hostile.
Not really. You are, I presume, posting that code to try and
make some kind of point about how "readable" it is. But it's
not readable unless you already know what it does.
What it does not relevant. This is simply defining an array of T. But
because T happens to be a function pointer, DB insists that an alias
must be created, and a new name invented.
Why? Probably because in C, the syntax for function pointers gets hairy.
I dunno; your syntax didn't seem any clearer to me.
Yeah, the C is so much clearer. Of course, you would all lie through[...]
your teeth anyway before you'd admit mine might be simpler.
On 21/10/2026 01:56, Dan Cross wrote:
In article <11b8qqg$3ejlp$1@dont-email.me>, bart <bc@freeuk.com> wrote:
On 20/10/2026 22:44, Dan Cross wrote:
In article <11b8j17$3btus$1@dont-email.me>, bart <bc@freeuk.com> wrote: >>>>> On 20/10/2026 20:24, Dan Cross wrote:
In article <11b7k22$2v8e5$1@dont-email.me>, bart <bc@freeuk.com> wrote: >>>>>
The point is that the name you chose is meaningless to anyone
other than you. What's a PCL? Phase Control Line? Printer
Command Language? Photon Compressor Loop?
Within the context of that application then it would be clear. You're >>>>> just being overly hostile.
Not really. You are, I presume, posting that code to try and
make some kind of point about how "readable" it is. But it's
not readable unless you already know what it does.
What it does not relevant. This is simply defining an array of T. But
because T happens to be a function pointer, DB insists that an alias
must be created, and a new name invented.
Why? Probably because in C, the syntax for function pointers gets hairy.
I dunno; your syntax didn't seem any clearer to me.
Yeah, the C is so much clearer. Of course, you would all lie through
your teeth anyway before you'd admit mine might be simpler.
bart <bc@freeuk.com> writes:
[...]
Yeah, the C is so much clearer. Of course, you would all lie through[...]
your teeth anyway before you'd admit mine might be simpler.
You preemptively accuse someone of being a liar, and then you wonder
why people are hostile to you.
Tone down the insults and hyperbole.
t to end each case-sequence in a switch statement with
a break-statement: put the break at the same indentation level as the case-clause as well as the switch-expression. That way, you can scan
your eye down a single line f
On 20/10/2026 16:02, David Brown wrote:
On 20/10/2026 16:11, bart wrote:
The other was C. There, several choices were made:
* To start with that Fortran style except that [] are used
* To decree that that 'A[20]' syntax is supposed to match indexing of
˙˙ A as it might appear in an expression
* To introduce "*" as a prefix dereference operator in expressions ...
* ... which then means that a prefix "*" appears in the declaration too
* A further complication was to allow function pointers within that a
˙˙ declaration list
I don't see a problem with that.˙ If you need to declare a function
pointer, you need to declare it in a declaration list.
To me, the big disadvantage of C's declaration syntax is that it lets
you declare things of different (but related) types in the same
declaration.
Yes, but that doesn't bite so much because it is uncommon.
or, more common and therefore worse :
˙˙˙˙˙int * a, b;
(See below.)
I was going to say it was right-to-left, but it can be considered both* Yet one more which came later was to add 'const', where placement now
˙˙ gets confusing
Some people do find it hard to understand the difference between :
˙˙˙˙˙const int * p;
˙˙˙˙˙int * const q;
˙˙˙˙˙const int * const r;
I note that this is despite the clear left-to-right nature of "const"
here.
and thus not clear:
˙˙˙ const int const * const p;
˙˙˙˙˙ 1˙˙˙˙˙˙˙˙ 2˙˙˙˙˙˙ 3
const 1 applies to the basetype to its right.
const 2 applies to the basetype to its left.
(Both also can be in the middle with compound types like 'long long'!)
const 3 is tricky: I think it applies to the * to its left, since it
says that the pointer value itself is const. But 'p' has type 'pointer
to', so it could apply to that directly.
What about this however:
˙˙ int * const *˙ p;
˙˙˙˙˙˙ 1˙˙ 2˙˙ 3
I think here, const 2 applies to * 1, which is to it's left, and can't
apply to 'p' as that is the other side of the * 3.
Fair to say that is a complete mess, and it is error prone.
With a LTR syntax that a postfix deref would achieve, 'const' would
always be written immediately to the left of any * modifiers. (It is meaningless for arrays and functions.)
It is never applied directly to a variable name.
For base types, it can be applied on the left, but C would still allow
it on the right or in the middle, or all three with duplicates.
That means there would be an ambiguity here where there is no identifier between 'int' and 'const':
˙˙ (const int const *)
For such reasons I would restrict base type const to be only on the left.)
Complicated types are a minority.
I've showed even simple types or trying to use 'const' get becomes confusing.
So, PARENTHESES HAVE BEEN ELIMINATED for purpose of disambiguating
array/pointer and pointer/array, both within expressions and within
type-declarations.
Agreed.
But does that make a significant difference?˙ I don't think so.
It would make a HUGE difference:
(1) It helps to fix that confusion above
(2) You don't need parentheses so no need to remember if you want
˙˙˙ (*A)[] or *A[]. Those will disappear from expressions too; less
˙˙˙ clutter all round.
(3) It simplifies indexing of pointer-to-array from (*A)[i] to A*[i], so
˙˙˙ that actual array pointers, which are more type-safe, could start to
˙˙˙ appear more in C rather than the current T* idiom
(4) For pointers to structs, these are the patterns:
˙˙˙ prefix *˙˙˙ With ->˙˙˙ With postfix *
˙˙˙ (*P).m˙˙˙˙˙ P->m˙˙˙˙˙˙ P*.m
˙˙˙ (**P).m˙˙˙˙ (*P)->m˙˙˙ P**.m
˙˙˙ (***P).m˙˙˙ (**P)->m˙˙ P***.m
Which column looks the tidiest?
(5) With prefix *, a pointer type looks like 'T*'; notice the * is on
˙˙˙ the right, not left! With postfix *, it would all be consistent. You
˙˙˙ also wouldn't have 'T*A'; that would be an error (T* only happens
˙˙˙ when there is no name)
(6) Your 'int * a, b' example would become:
˙ int a *, b;
Much easier, even with that space, to see that '*' does not belong to
the base type but is a modifier for that variable.
It doesn't fix everything, so you'd still have this:
˙˙ int p* = &a;
˙˙˙˙˙˙ p* = a;
To fix this requires that all modifiers apply to the base type. But this would be a massive change. The above is merely what happens when *
becomes postfix.
A mistake that could so easily have been avoid by choosing a
different precedence as shown above. Did none of the thousand people
working at Bell Labs (according to a comment in DC's follow-ip) spot
this and say anything?
I suspect the folks at Bell Labs were too busy writing real code to be
bothered by how confused you would be with artificially complex types.
So you agree the process was very different compared to that which lead
to Ada for example? Just a couple of guys left to do their own thing.
(Maybe they were respected enough that no one dared to offer any constructive criticism, or if they did then it was dismissed. As happens here.)
(ACTUALLY IT IS NOT TOO LATE. A secondary postfix deref op could have
been added. This could have been done 50 years ago, with the original
eventually deprecated.
It /is/ too late - far, far too late.˙ It would be a terrible idea to
add a new postfix dereference operator to give two different operators
with no benefit other than very occasionally reducing the need for
parentheses.
But a special operator P->m to do the same job as (*P).m was fine! The
new op would eliminate the need for ->.
David Brown <david.brown@hesbynett.no> writes:
[...]
Without typedef's, that function signature would be something like :
signed char dns_gethostbyname(const char *hostname, struct ip_addr
*addr, void (*found)(const char *name, const struct ip_addr
*ipaddr, void *callback_arg), void *callback_arg);
I might write that as:
signed char dns_gethostbyname(
const char *hostname,
struct ip_addr *addr,
void (*found)(
const char *name,
const struct ip_addr *ipaddr,
void *callback_arg
),
void *callback_arg
);
so the indentation and structure reflects the semantics. I find
that much clearer than your version. (I'm not commenting on the
merits of typedefs.)
On 20/10/2026 13:58, David Brown wrote:
On 20/10/2026 13:41, bart wrote:
But let us take a concrete example.˙ These network functions are from
the LWIP network stack, which is designed to be used on small embedded
systems that may not have any kind of OS - so it uses call-backs for
asynchronous programming.
An example API function is this :
err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ dns_found_callback found, void *callback_arg)
The returned "err_t" can be "ERR_OK" (indicating the "hostname" is in
the DNS cache and *addr is set to the IP), "ERR_ARG" for argument
errors, or "ERR_INPROGRESS" to indicate that the stack is looking up
the DNS name, and will call the callback when there is a final result
or timeout.
Without typedef's, that function signature would be something like :
signed char dns_gethostbyname(const char *hostname, struct ip_addr
˙˙˙˙˙*addr, void (*found)(const char *name,˙˙˙ const struct ip_addr
˙˙˙˙˙*ipaddr, void *callback_arg), void *callback_arg);
Do you expect anyone to believe you if you claim this is easier to
read than the real declaration using typedefs?˙ I'll believe you if
you say you find the original hard to read - but not if you claim the
"untypedef'ed" version is clearer.
Neither are great. But let's first lay them out better:
˙err_t
˙˙˙ dns_gethostbyname(
˙˙˙˙˙ const char *hostname,
˙˙˙˙˙ ip_addr_t˙ *addr,
˙˙˙˙˙ dns_found_callback found,
˙˙˙˙˙ void˙˙˙˙˙˙ *callback_arg
˙˙˙ );
Here, one problem is that there are 3 types that I don't know and would
have to look up.
The long version at least has all the info in one place:
˙signed char
˙˙˙ dns_gethostbyname(
˙˙˙˙˙ const char˙˙˙˙ *hostname,
˙˙˙˙˙ struct ip_addr *addr,
˙˙˙˙˙ void (*found)(const char *name, const struct ip_addr *ipaddr,
void *callback_arg),
˙˙˙˙˙ void˙˙˙˙˙˙˙˙˙˙ *callback_arg
˙˙˙ );
That signed char return is unusual; why not 'int'? (How would you even
print an 'err_t' value anyway)?
That 'ip_addr_t' turns out to be a struct. For those I would use
typedefs anyway; I rarely use struct tags and you have to invent an identifier in either case.
Then we come to the function pointer, which is a quite a chunky one, but let's work with it. Here, I would question whether you really need those types in there, and especially those names.
Presumably you have a regular function of your own with the same
signature? You anyway never directly 'call' this parameter with
arguments; you just pass it the address of your handler.
Or do you use that typedef as documentation?
Where does the info come from anyway; does the library export a suitable typedef? In that case you might as well use it. But if not, info must
come from elsewhere.
Anyway with some tweaks in place, using the struct typedef and using an inline function pointer type, it would look like this:
˙signed char
˙˙˙ dns_gethostbyname(
˙˙˙˙˙ const char *hostname,
˙˙˙˙˙ IP_addr˙˙˙ *addr,
˙˙˙˙˙ void˙˙˙˙˙ (*found)(char*, IP_addr*, void *),
˙˙˙˙˙ void˙˙˙˙˙˙ *arg
˙˙ );
In this form, it is not wildly different from your short version.
So I would look at other ways of tidying up before resorting to
extraneous typedefs.
But here, there may well be an extra reason to use a callback typedef; I don't have the full details.
On 21/10/2026 03:04, bart wrote:
[snip]
Anyway with some tweaks in place, using the struct typedef and using an
inline function pointer type, it would look like this:
˙signed char
˙˙˙ dns_gethostbyname(
˙˙˙˙˙ const char *hostname,
˙˙˙˙˙ IP_addr˙˙˙ *addr,
˙˙˙˙˙ void˙˙˙˙˙ (*found)(char*, IP_addr*, void *),
˙˙˙˙˙ void˙˙˙˙˙˙ *arg
˙˙ );
In this form, it is not wildly different from your short version.
Not wildly different, just worse by counter-productively removing the >abstractions and appropriate type names, and uselessly cluttering the >declaration with unnecessary detail.
On 20/10/2026 22:07, bart wrote:
On 20/10/2026 16:02, David Brown wrote:
On 20/10/2026 16:11, bart wrote:
* A further complication was to allow function pointers within that a
˙˙ declaration list
To me, the big disadvantage of C's declaration syntax is that it lets
you declare things of different (but related) types in the same
declaration.
Yes, but that doesn't bite so much because it is uncommon.
Unfortunately not - but it is uncommon to mix objects and function declarations, or objects of wildly different real types.
˙˙˙˙ const int const * const p;
˙˙˙˙˙˙ 1˙˙˙˙˙˙˙˙ 2˙˙˙˙˙˙ 3
const 1 applies to the basetype to its right.
const 2 applies to the basetype to its left.
These are redundant - they do the same thing.˙ (I'd have preferred if
the ordering rules were strict - allowing only "const int" or "int
const" - but at least people are usually consistent in their style.)
(Both also can be in the middle with compound types like 'long long'!)
const 3 is tricky: I think it applies to the * to its left, since it
says that the pointer value itself is const. But 'p' has type 'pointer
to', so it could apply to that directly.
Yes - it is "p" that is const,˙ not the "*".
What about this however:
˙˙˙ int * const *˙ p;
˙˙˙˙˙˙˙ 1˙˙ 2˙˙ 3
I think here, const 2 applies to * 1, which is to it's left, and can't
apply to 'p' as that is the other side of the * 3.
*p is of type "int * const" - thus you can use "*p" to access a pointer- to-int, but you can't use *p to change that pointer-to-int.
Fair to say that is a complete mess, and it is error prone.
No, it is not at all fair to say that.˙ It is fair to say that a
different way of writing types might make it easier to understand - but that's a /long/ way from saying it is "a complete mess".˙ And you can't
call it "error prone" unless you know that people regularly use such declarations, and often have bugs in their code as a result of doing so incorrectly.˙ I think that is an unrealistic claim.
You can write this in C++ :
˙˙˙˙// This bit is only needed once
˙˙˙˙template <typename T> using ptr = T *;
˙˙˙˙// p is a pointer to a const pointer to an int
˙˙˙˙ptr<const ptr<int>> p;
That's LTR syntax.˙ Sure, it also has < > parentheses, but that's a
minor point since the ordering of the components is what apparently
matters so much.
Or you can write :
˙˙˙˙typedef int * p_int;
˙˙˙˙const p_int * p;
Thus p is a pointer to a "const p_int", where a "p_int" is a pointer to
an int.
These are different ways to write the same type, including one that is
LTR, and the main hinder to understanding remains the same - what is the type for?
I've showed even simple types or trying to use 'const' get becomes
confusing.
No, you haven't.
It would make a HUGE difference:
Your points below are all true, but IMHO all very minor, and do not add
up to anything much.
Your invented confusion.
That doesn't matter in practice.
I don't see that as significant.
I do agree that the decay of expressions using array types into pointer types is a source of error in C code - though I do not think it is as
bad as you do.
But I just don't see pointer-to-array expressions to be common enough
for the difference you describe to be important.
(4) For pointers to structs, these are the patterns:
˙˙˙˙ prefix *˙˙˙ With ->˙˙˙ With postfix *
˙˙˙˙ (*P).m˙˙˙˙˙ P->m˙˙˙˙˙˙ P*.m
˙˙˙˙ (**P).m˙˙˙˙ (*P)->m˙˙˙ P**.m
˙˙˙˙ (***P).m˙˙˙ (**P)->m˙˙ P***.m
Which column looks the tidiest?
Far and away the most common - by orders of magnitude - are pointers to structs.˙ "p->m" looks fine to me, and I prefer it to "p*.m".
(5) With prefix *, a pointer type looks like 'T*'; notice the * is on
˙˙˙˙ the right, not left! With postfix *, it would all be consistent. You
˙˙˙˙ also wouldn't have 'T*A'; that would be an error (T* only happens
˙˙˙˙ when there is no name)
The C declaration syntax is "declaration follows use".˙ If "*" were a postfix operator, then the declaration of a pointer-to-int would become:
˙˙˙˙int p*;
while the type of p would be "int *".˙ So you would still have an inconsistency there, unless you also changed the way C has its
declarations.
(6) Your 'int * a, b' example would become:
˙˙ int a *, b;
Much easier, even with that space, to see that '*' does not belong to
the base type but is a modifier for that variable.
It's still bad.˙ I don't think finding a way to make it easier to write
bad code is a good idea.
So basically, the suggestion would change some very minor things -
mostly in subjective ways - and not actually do anything for aspects of
the language where there is more of a consensus that C is sub-optimal.
And for this, you would want a fundamental change to one of the most
used operators in all C code!
On 21/10/2026 03:04, bart wrote:
Where does the info come from anyway; does the library export a
suitable typedef? In that case you might as well use it. But if not,
info must come from elsewhere.
Of course it "exports" the typedef - it is in one of the library's headers.
In article <11b7k22$2v8e5$1@dont-email.me>, bart <bc@freeuk.com> wrote:
On 20/10/2026 09:01, David Brown wrote:
On 19/10/2026 23:28, bart wrote:
(Funny that when I suggest that nested loop breaks are uncommon,
everyone says I'm wrong! Some even write 200-line made-up examples to
prove their point.)
I don't remember "everyone" saying you were wrong to say that nested
loop breaks are uncommon - in fact, I don't remember /anyone/ saying
that was wrong.
(There was a LOT of antipathy towards my idea to fix the common case of
'loop-break' clashing with 'switch-break', BECAUSE it did not fix the
problem of nested loop-break, which is uncommon, even though that wasn't
the aim.)
Those are two different things. No one disagrees with you that
"nested break from a switch inside of a loop" is relatively more
common than other variants.
Using that as an excuse not to provide a more general mechanism
because you already have a proposal for the specific case is
what I and others took you to task for. I find this ironic,
since you rail against things in C that you do not like, citing
the most ridiculous examples you can think of that do not show
up in actual programs, yet for something where it is pointed out
to you that your solution does not generalize, you claim that it
does not need to because ... the general case rarely shows up in
a real program.
There is no reason to abstract away that function pointer type.
You probably do so in C /because/ the type involves * () and [] but
have somehow persuaded yourself that it just better that way.
Do you hear that whooshing noise?˙ It is the sound of the point flying
far above your head.
Here is an example of some sensible function typedefs, all from third-
party code (so not my "peculiar" style)
typedef void (*TimerCallbackFunction_t)( TimerHandle_t xTimer );
TimerHandle_t xTimerCreate(˙ const char * const pcTimerName,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ TickType_t xTimerPeriodInTicks,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ UBaseType_t uxAutoReload,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ void * pvTimerID,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ TimerCallbackFunction_t pxCallbackFunction );
typedef void (*lwip_thread_fn)(void *arg);
typedef void (*tcpip_init_done_fn)(void *arg);
typedef void (*tcpip_callback_fn)(void *ctx);
typedef void (* sys_timeout_handler)(void *arg);
typedef void (*dns_found_callback)(const char *name,
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ const ip_addr_t *ipaddr, void *callback_arg);
This is the kind of C I find hard to read. There are lots of typedefs
but few uses of those typedefs that I can see, so I don't know how much
difference they make.
You again missed the entire point. You may not see many uses
of them, but as David says, the `typedef`s give you
domain-specific *names* understandable to the programmer: a
programmer can see the `sys_timeout_handler` type instantly know
that this has a different function than the,
`tcpip_callback_fn`, despite the having the same type.
The other point is that the ridiculous examples you make up to
illustrate your distaste for C declaration syntax basically do
not appear in real programs.
[snip]
I've left in the regular parameter names, even though C doesn't need
them, but they are quite heavy - you don't really need those
Hungarian-style prefixes.)
Well, I guess this buys you one thing: the parameter name for the last
parameter is to the right of its type, rather than be inside it. But a C
expert should not be fazed by that.
Here is the same function as I might write it in an alternative syntax.
I've kept the same names, but changed case-style and removed prefixes
and suffixes. I've capitalised user-type names:
func TimerCreate( # (retain case if FFI import)
ichar timername,
Ticktype timerperiodinticks,
Ubasetype autoreload,
ref void timerid,
ref proc(Timerhandle) callbackfn)
In this form, it's hard to see what benefit a typedef would give for
that last parameter; it is simple enough.
What is your point? Do you have one? If you don't want to use
C, don't use C.
There are plenty of languages that can do this kind of thing
that are not C and have syntax and semantics closer to what you
seem to want. Here's an example in Rust:
pub trait TimerHandle { ... }
fn CreateTimer<T>(
timer_name: &str,
period: std::time::Duration,
auto_reload: bool,
timer_id: T,
handler: fn(&dyn TimerHandle),
) -> Result<Timer<T>, TimerError>
I didn't know what an `UBaseType_t` is, and while "autoreload"
sounded pretty intuitive, I wasn't sure about the semantics, so
I looked it up (the example comes from `FreeRTOS`). In this
context, it is a boolean saying whether the timer should repeat
with the given periodicity, or whether it is a one-shot.
The timer_id is opaque to the timer, and it looks like it's used
to facilitating the handler accessing timer-specific data. In
C, passing it as a `void *` is used as a way to get a poor-man's
overloading. But Rust has generics, I just made it generic over
some type T.
If I were writing this from scratch in Rust, a language that has
generics, closures, and so sum types, I'd do the whole thing
differently; see the end for an example.
But I digress. The point here is, Bart, that alternatives exist
if you don't like C. You don't have to keep posting, over and
over again, in comp.lang.c of all places, about how oh so
terribly awful C is. If you don't want to program in C, simply
don't program in C.
Ask yourself why the typedefs are used.˙ Look at the /names/.˙ Those
last four are all from the same network stack library, and are all
typedefs for "void (*)(void*)".
Until you mentioned it, I hadn't noticed. So typedef has done a good job
of hiding that useful fact! But looking more closely, it is the first
four of the last five.
Let's take one:
typedef void (*lwip_thread_fn)(void *arg);
That 'arg' is not much use for a start (other than being a hint that
this particular (...) is where the parameters go).
So, maybe this is used like this:
void F(lwip_thread_fn lwip_thread_callback);
I have no idea what you're trying to say here. The obvious (and
honestly, excusable) syntax error aside, what is F? It's a
function that, what, takes two function pointers?
The type defined by `lwip_thread_fn` is a pointer to a function
that takes a void pointer (`void *`) as its sole arugment, and
returns `void` (that is, has no meaningful return value).
Intuitively, the name implies that this is the function run as
some thread, so we'd pass it to a thread creation function. The
usual shape of those things is to give them a pointer to some
function to run in the new thread, and a pointer to some
arguments to be passed to that function.
For example:
void
whatever(void *argp)
{
struct Args *args = argp;
while (keep_running()) {
// Do the thing the thread is supposed to do.
}
thread_exit(SUCCESS);
}
thread_t *
start_the_whatever_thread(void)
{
struct Args *args = malloc(sizeof(*args));
if (args == NULL) abort();
memset(args, 0, sizeof(*args));
args->whatever = something();
// etc...
thread_t *thr = thread_create(whatever, args);
if (thr == NULL) abort();
return thr;
}
Something could start this as:
thread_t *whatever_id = start_the_whatever_thread();
At some point later, if you want to wait for the thread to
exit, you'd run:
(void)thread_join(whatever_id);
Note this is decently complex behavior, but it's actually quite
intuitive from the name and the type.
Here you have two identifiers imparting the sort kind of information; a
tautology.
That's not what a tautology is.
If that function pointer pattern is common, or recurs in a suite of
functions, I might also have used a typedef, but with a common name.
Then you loose the domain specificity; you can't tell from the
name whether you need an LwIP thread, or a callback, or a
something run in a different thread, or just a plain 'ol
function you want to apply to run every now and again for a side
effect.
Then only one would be needed, say:
typedef void (*stack_callbackfn)(void);
I might have done the same in that alternate syntax as it would start to
get cluttery: 'ref proc(ref void)', but also in order to define that
common pattern in one place.
I dunno. Sounds like you have no idea what the code that David
posted is meant to do. But that's a "you" problem.
Note that 'pcl' in my example /is/ a typedef; here it makes sense as
it is used in 100s of places. This function pointer occurs in only one >>>> place.
I'm sorry, I had mistaken you for a programmer who wanted to write good, >>> clear programs.˙ Naming things is not a shortcut to save keypresses.
Isn't that one of the main uses of typedefs? So as to give a handy,
'euphonious' one-token alias to an elaborate typedef.
It also allows you to change the type in one place without having to
update hundreds of instances.
It also allows the type to be opaque.
The point is that the name you chose is meaningless to anyone
other than you. What's a PCL? Phase Control Line? Printer
Command Language? Photon Compressor Loop?
Saving keypresses is bonus benefit, but if it is shorter, then it can
also help readability as other critical elements are not overshadowed.
So I'm not sure what objection you have to this particular use of it.
Have you ever written a large program that was maintained by
anyone other than yourself?
Here is the one place I do remember using typedef for a function pointer
(from an old project, not in C):
type fnptr = ref proc
repeat
(fnptr(pcptr^))^()
until stopped
It's used as a cast, but reason I have it is because with simple cast
syntax, which is 'T(X)', the meaning without it would be ambiguous (a
grammar issue that I might fix one day).
Rather than fallback to standard cast syntax (which is 'cast(X, T)'),
this was tidier.
I can only guess at what this may mean. Hazarding a guess,
`pcptr` is a "pointer to a program counter", which is a
reference type to some type that represents some executable
memory location in the program. You then have a loop that runs
until "stopped" is true where you indirect the program counter
pointer, cast it to a pointer to a function, and then invoke
the function, right? One presumes you have the, "PC Pointer"
because it changes over time, otherwise, you'd just give
whatever it points to a name and call it.
More generally, I fail to see what this is trying to
demonstrate. If it's to show some sort of imagined superiority
over C, I don't see it; that's sort of thing is easy enough to
write:
typedef void (*fnptr)(void);
// Assume uintptr_t *pcptr is declared somewhere.
do {
((fnptr)*pcptr)();
} while (!stopped);
E.g.,
```
term% cat b.c
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
static void first(void);
typedef void (*fnptr)(void);
bool stopped = false;
uintptr_t pc = (uintptr_t)first;
uintptr_t *pcptr = &pc;
void
done(void)
{
printf("done\n");
stopped = true;
}
void
second(void)
{
printf("second\n");
*pcptr = (uintptr_t)done;
}
void
first(void)
{
printf("first\n");
*pcptr = (uintptr_t)second;
}
void
run(void)
{
do {
((fnptr)*pcptr)();
} while (!stopped);
}
int
main(void)
{
run();
return 0;
}
term% gcc-16 -std=c11 -pedantic -o b b.c
term% ./b
first
second
done
term%
```
BTW what name would be given to such a function pointer type?
I have no idea what your code is supposed to do,
It's a table of function pointers! All sharing the same signature.
That's pretty generic. Is it really that hard to guess? You don't need
to know what they do, other than at some point they will be called as
handlertable[i](arg).
That part is fine.
What's utterly mystifying is what you are trying to show, if
anything, by posting it. Is this supposed to prove some kind of
point? Your code is not _a priori_ easier to understand than
the equivalent C code; if anything, it is harder to understand
because of your poorly chosen names.
- Dan C.
Rust implementation of Timers, mentioned above<--
As mentioned above, if I were providing the FreeRTOS timers API
in an alternative language, I'd write it differently from the
start. In particular, I'd use an enumeration to describe the
behavior with respect to repeating, and I'd use a closure to
obviate the need for the opaque id. Something that isn't easy
to express in the original API is a type of repeating timer that
waits for the initial period, and then repeats with some
different period.
Something like this:
```rust
pub mod timer {
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::Duration;
/// Errors that may occur when working with timers.
#[derive(Clone, Copy, Debug)]
pub enum Error {
Running,
CantStop,
WontStop,
}
/// Describes the kind of a timer, as defined by its
/// periodicity.
///
/// A timer can either be a `OneShot` timer, which fires
/// once, after its timeout expires, or it may be a Repeating
/// timer, which will automatically reset after its handler
/// is run and continue firing at the rate defined by the
/// initial timeout, or it can be a periodic timer, that
/// will fire the first time at the initial timeout, and
/// then repeatedly a potentially different timeout. This
/// use case can be simulated by a OneShot timer that
/// creates a repeating Timer, but
///
/// Once started, Repeating and Periodic timers continue
/// firing until explicitly stopped.
#[derive(Clone, Copy, Debug)]
pub enum Kind {
OneShot,
Repeating,
Periodic(Duration),
}
/// A named timer, that is handled by the given callback.
pub struct Timer<'a, F> {
pub name: &'a str,
pub kind: Kind,
pub timeout: Duration,
callback: F,
running: AtomicBool,
// Whatever other innards...
// ...
}
/// A read-only "view" into the timer.
pub trait TimerView {
fn name(&self) -> &str;
fn kind(&self) -> Kind;
fn timeout(&self) -> Duration;
}
impl<'a, F: Fn(&dyn TimerView)> Timer<'a, F> {
/// Creates a new named timer of the given kind with an
/// initial timeout. When the timeout expires, it will
/// automatically invoke the given handler.
pub fn new(
name: &'a str,
timeout: Duration,
kind: Kind,
callback: F,
) -> Timer<'a, F> {
let running = AtomicBool::new(false);
Self {
name,
kind,
callback,
timeout,
running,
}
}
/// Starts the timer.
pub fn start(&self) -> Result<(), Error> {
if self.running.swap(true, Ordering::AcqRel) {
return Err(Error::Running);
}
self.arm(self.timeout)?;
Ok(())
}
/// Stops the timer.
///
/// Note that this inherently races with the timer firing,
/// and a timer event that occurs while we are disabling
/// the timer may still invoke `fired` after this returns.
///
/// Callers are advised to determine definitively that
/// there are no events pending for this timer before
/// destroying the `Timer` object.
pub fn stop(&self) -> Result<(), Error> {
let was_running = self.running.swap(false, Ordering::AcqRel);
if !was_running {
return Err(Error::WontStop);
}
self.disarm();
Ok(())
}
// Automatically called when the timeout fires.
//
// # Safety
//
// Nothing may be mutably borrowing a reference to the
// Timer object when this is called.
pub(super) unsafe fn fired(&self) -> Result<(), Error> {
if !self.running.load(Ordering::Acquire) {
return Ok(());
}
(self.callback)(self);
match self.kind {
Kind::OneShot => Ok(()),
Kind::Repeating => self.arm(self.timeout),
Kind::Periodic(period) => self.arm(period),
}
}
// Arranges for `self.fired(self)` to be called when
// the given timeout expires.
fn arm(&self, timeout: Duration) -> Result<(), Error> {
// Does whatever one does here to actually arm the
// timer (e.g., calls a HAL to actually program a
// physical timer to interrupt after the amount of
// time specified by `Duration`, for example).
// ...
Ok(())
}
// Disables an armed timer, so that it does not fire
// after this returns.
fn disarm(&self) -> Result<(), Error> {
// whatever one does here to disarm an active timer
// ...
Ok(())
}
}
impl<F> TimerView for Timer<'_, F> {
fn name(&self) -> &str { self.name }
fn kind(&self) -> Kind { self.kind }
fn timeout(&self) -> Duration { self.timeout }
}
}
```
One might use this with something like,
```
let value = 42;
let cb = move |timer: &dyn timer::TimerView| {
println!(
"Timer '{}' fired; value is {} and duration was {} ms",
timer.name(),
value,
timer.timeout().as_millis()
);
};
let timeout = std::time::Duration::from_millis(100);
let timer = timer::Timer::new("timer", timeout, timer::Kind::OneShot, &cb);
timer.start().expect("Timer started");
//... at some point the timer fires and prints,
// 'Timer 'timer1' fired; value is 42 and duration was 100 ms'
}
```
On 21/10/2026 12:21, David Brown wrote:
On 21/10/2026 03:04, bart wrote:
Where does the info come from anyway; does the library export a
suitable typedef? In that case you might as well use it. But if not,
info must come from elsewhere.
Of course it "exports" the typedef - it is in one of the library's
headers.
You could have said that in the first place. So it's not really a choice then is it?
Then it makes sense to use what they have provided.
On 20/10/2026 22:44, Dan Cross wrote:
In article <11b8j17$3btus$1@dont-email.me>, bart˙ <bc@freeuk.com> wrote:
On 20/10/2026 20:24, Dan Cross wrote:
In article <11b7k22$2v8e5$1@dont-email.me>, bart˙ <bc@freeuk.com>
wrote:
The point is that the name you chose is meaningless to anyone
other than you.˙ What's a PCL?˙ Phase Control Line?˙ Printer
Command Language?˙ Photon Compressor Loop?
Within the context of that application then it would be clear. You're
just being overly hostile.
Not really.˙ You are, I presume, posting that code to try and
make some kind of point about how "readable" it is.˙ But it's
not readable unless you already know what it does.
What it does not relevant. This is simply defining an array of T. But because T happens to be a function pointer, DB insists that an alias
must be created, and a new name invented.
Why? Probably because in C, the syntax for function pointers gets hairy.
On the other hand, the code David posted _is_ readable, because
it uses the language to encode domain-specific information into
type names.
Maybe we should create aliases for function signatures more often then,
then we can encode that extra info.
So that instead of, for example:
˙˙˙ void SomeFunc(int x, int y) {printf("%d %d\n", x, y);}
you do:
˙˙˙ typedef void Take2Ints(int x, int y);
˙˙˙ Take2Ints SomeFunc {printf("%d %d\n", x, y);}
If you have a suite of functions sharing the signature, then it might be
a good idea. But funnily enough, you never see this being done.
(I don't know if this is legal C; but it works fine with my compiler:
˙ c:\m>type fred.c
˙ #include <stdio.h>
˙ typedef void Take2Ints(int x, int y);
˙ Take2Ints SomeFunc{printf("%d %d\n", x, y);}
˙ int main(void) { SomeFunc(10, 20); }
˙ c:\m>bcc -r -q fred
˙ 10 20
)
Yeah, you really just don't get it.One of us doesn't get it.
On 20/10/2026 21:24, Dan Cross wrote:
In article <11b7k22$2v8e5$1@dont-email.me>, bart <bc@freeuk.com> wrote:
[snip]
(There was a LOT of antipathy towards my idea to fix the common case of
'loop-break' clashing with 'switch-break', BECAUSE it did not fix the
problem of nested loop-break, which is uncommon, even though that wasn't >>> the aim.)
Those are two different things. No one disagrees with you that
"nested break from a switch inside of a loop" is relatively more
common than other variants.
Quibble - that is not established to my satisfaction. I am not
convinced that wanting a nested break for "switch inside loop" is more >common than wanting it for "loop inside loop". So I neither agree nor >disagree with that claim. I don't, however, think it matters much -
both are situations that turn up sometimes in code, and definitive
answers are neither possible nor useful.
[snip]
There are plenty of languages that can do this kind of thing
that are not C and have syntax and semantics closer to what you
seem to want. Here's an example in Rust:
pub trait TimerHandle { ... }
fn CreateTimer<T>(
timer_name: &str,
period: std::time::Duration,
auto_reload: bool,
timer_id: T,
handler: fn(&dyn TimerHandle),
) -> Result<Timer<T>, TimerError>
I didn't know what an `UBaseType_t` is, and while "autoreload"
sounded pretty intuitive, I wasn't sure about the semantics, so
I looked it up (the example comes from `FreeRTOS`). In this
context, it is a boolean saying whether the timer should repeat
with the given periodicity, or whether it is a one-shot.
FreeRTOS is written in C90 - a mistake, IMHO - and thus does not use
bool. Instead, it uses constants pdTRUE and pdFALSE of type
UBaseType_t. UBaseType_t is a type that is dependent on the target - >usually it is either 16-bit or 32-bit. But of course it doesn't matter
what the underlying types are - you use the typedef names, and the >documented constants.
The timer_id is opaque to the timer, and it looks like it's used
to facilitating the handler accessing timer-specific data. In
C, passing it as a `void *` is used as a way to get a poor-man's
overloading. But Rust has generics, I just made it generic over
some type T.
FreeRTOS uses "void *" to mean "pointer to internal structure that you >shouldn't be messing with". It uses this far too often, and is, IMHO, a >poor design choice. (I also dislike the silly Hungarian naming.) I
would much preferred if there had been :
struct Internal_Timer_Struct;
typedef struct Internal_Timer_Struct * timer_id_t;
and then the parameter "timer_id_t timer_id". So in a re-write, it
would not be a generic. (You might choose to use a generic for the
handler function type, so that handler callbacks could have parameters
of other types, but not for the timer id.)
I am using these declarations from FreeRTOS (and LWIP) to demonstrate
the use of function typedefs in massively popular codebases, not to
claim FreeRTOS is a paradigm of C code design!
For example:
[snip]
Note this is decently complex behavior, but it's actually quite
intuitive from the name and the type.
You have got a very clear picture here, much of it from the names of the >types. For a Rust programmer, you give a good impression of experience
with C :-)
The only mistake you made is that programmers working on systems using >FreeRTOS and the like, have a fear and loathing of "malloc", have never >heard of "abort()", and do not join our threads because they all run
until the power is switched off.
[snip]
Or just have :
fnptr pc = first;
fnptr *pcptr = &pc;
I don't see a need for "uintptr_t", except so that you have to have
casts like Bart had.
[Snip a bunch of Rust code; the point of which being that
bart need not complain about lack of an alternative to C]
David Brown <david.brown@hesbynett.no> writes:
On 19/10/2026 23:27, Janis Papanagnou wrote:[...]
˙ * a b˙˙˙˙ PN (Polish Notation)
There is no term "Polish Notation" - except as occasionally used to
mean /postfix/ as a short form of "Reverse Polish Notation". RPN was
invented, or at least popularised, by the Polish logician Jan
?ukasiewicz (I admit to looking that up on Wikipedia!). There is no
"PN" opposite.
Yes, there most certainly is, and "* a b" is a good example of it.
https://en.wikipedia.org/wiki/Polish_notation
Jan ?ukasiewicz invented what we now call Polish notation in 1924.
`+ 3 4` is an example (which yields 7). Lisp syntax is more or
less Polish notation with added parentheses. (I'm sure the phrase
"more or less" is doing a lot of work.)
Reverse Polish Notation, RPN, is very well known because it's
used by some calculators, particularly those made by HP. It's a
postfix notation. An example of RPN is `3 4 +` (which also yields 7).
I've never seen the term "Polish Notation", without "Reverse", used
to refer to postfix notation. PN is prefix; RPN is postfix.
I see that Janis already pointed out your error. I'm disappointed
that your followup did not acknowledge it. (I'm not commenting on the
rest of what Janis wrote.)
On 21/10/2026 10:20, David Brown wrote:
On 20/10/2026 22:07, bart wrote:
On 20/10/2026 16:02, David Brown wrote:
On 20/10/2026 16:11, bart wrote:
* A further complication was to allow function pointers within that a >>>>> ˙˙ declaration list
To me, the big disadvantage of C's declaration syntax is that it
lets you declare things of different (but related) types in the same
declaration.
Yes, but that doesn't bite so much because it is uncommon.
Unfortunately not - but it is uncommon to mix objects and function
declarations, or objects of wildly different real types.
That's what I meant.
˙˙˙˙ const int const * const p;
˙˙˙˙˙˙ 1˙˙˙˙˙˙˙˙ 2˙˙˙˙˙˙ 3
const 1 applies to the basetype to its right.
const 2 applies to the basetype to its left.
These are redundant - they do the same thing.˙ (I'd have preferred if
the ordering rules were strict - allowing only "const int" or "int
const" - but at least people are usually consistent in their style.)
(Both also can be in the middle with compound types like 'long long'!)
const 3 is tricky: I think it applies to the * to its left, since it
says that the pointer value itself is const. But 'p' has type
'pointer to', so it could apply to that directly.
Yes - it is "p" that is const,˙ not the "*".
I would disagree. This type can also be written as:
˙(const int const * const)
There is no 'p' to apply to. The type describes a pointer to an integer.
The first two consts say, redundantly, that the integer value is const.
The third must then apply to the pointer.
What about this however:
˙˙˙ int * const *˙ p;
˙˙˙˙˙˙˙ 1˙˙ 2˙˙ 3
I think here, const 2 applies to * 1, which is to it's left, and
can't apply to 'p' as that is the other side of the * 3.
*p is of type "int * const" - thus you can use "*p" to access a
pointer- to-int, but you can't use *p to change that pointer-to-int.
But what exactly does this 'const' apply to?
I'm suggesting any 'const' applies either to the base type (the one on
the left) or to a particular '*'.
In that case the latter 'const's must apply right-to-left to the
preceding '*'.
Fair to say that is a complete mess, and it is error prone.
No, it is not at all fair to say that.˙ It is fair to say that a
different way of writing types might make it easier to understand -
but that's a /long/ way from saying it is "a complete mess".˙ And you
can't call it "error prone" unless you know that people regularly use
such declarations, and often have bugs in their code as a result of
doing so incorrectly.˙ I think that is an unrealistic claim.
If there's any confusion about which const applies to which type
element, then mistakes can be made.
You can write this in C++ :
˙˙˙˙˙// This bit is only needed once
˙˙˙˙˙template <typename T> using ptr = T *;
˙˙˙˙˙// p is a pointer to a const pointer to an int
˙˙˙˙˙ptr<const ptr<int>> p;
That's LTR syntax.˙ Sure, it also has < > parentheses, but that's a
minor point since the ordering of the components is what apparently
matters so much.
That it is LTR is now irrelevant because I find that incomprehensible anyway. You've turned a linear chain a nested structure ... oh never
mind, I don't even want to go there with C++.
Or you can write :
˙˙˙˙˙typedef int * p_int;
˙˙˙˙˙const p_int * p;
Thus p is a pointer to a "const p_int", where a "p_int" is a pointer
to an int.
So, a common pattern with you is to use workarounds so that you
effectively emulate LTR type patterns. Because they are easier to work
with and understand.
So you do appreciate how they facilitate things, even though they
introduce an extra level of indirection and also disseminate the type information across the program.
But you want to underplay how useful it would be to have natural LTR
type declarations within a syntax.
These are different ways to write the same type, including one that is
LTR, and the main hinder to understanding remains the same - what is
the type for?
If you create a type alias voluntarily (I don't mean structs where
either a tag or a typedef needs to be created) then yes the name should impart something useful.
But in my view this is often taken too far. Sometimes you have structs
where every member has a different user-type. When you look further, you find they are all ints. That is just obfuscation.
(I would accept enumeration types if the compiler can employ that info
to improve type safety, but that seems to be limited.)
I've showed even simple types or trying to use 'const' get becomes
confusing.
No, you haven't.
OK. That is not surprising.
It would make a HUGE difference:
Your points below are all true, but IMHO all very minor, and do not
add up to anything much.
It would eliminate half the issues with C's type syntax. Probably CDECL wouldn't need to exist. Lots of () disappear. It would make pointers-to- arrays more viable.
But that's nothing in your view. OK again.
Your invented confusion.
That doesn't matter in practice.
I don't see that as significant.
I do agree that the decay of expressions using array types into
pointer types is a source of error in C code - though I do not think
it is as bad as you do.
I didn't say anything about, and that wouldn't be affected.
But I just don't see pointer-to-array expressions to be common enough
for the difference you describe to be important.
If you're passing arrays to a function by-reference then the natural way
is to a have a pointer to the array. C can do that, but nobody ever does
so, probably because indexing is then so ugly.
With my idea, (*A)[i] turns into A*[i], a bit less ugly.
(4) For pointers to structs, these are the patterns:
˙˙˙˙ prefix *˙˙˙ With ->˙˙˙ With postfix *
˙˙˙˙ (*P).m˙˙˙˙˙ P->m˙˙˙˙˙˙ P*.m
˙˙˙˙ (**P).m˙˙˙˙ (*P)->m˙˙˙ P**.m
˙˙˙˙ (***P).m˙˙˙ (**P)->m˙˙ P***.m
Which column looks the tidiest?
Far and away the most common - by orders of magnitude - are pointers
to structs.˙ "p->m" looks fine to me, and I prefer it to "p*.m".
But where's the consistency? Sometimes "." is used for member selection,
and sometimes "->". And with two pointer levels, you need both!
(6) Your 'int * a, b' example would become:
˙˙ int a *, b;
Much easier, even with that space, to see that '*' does not belong to
the base type but is a modifier for that variable.
It's still bad.˙ I don't think finding a way to make it easier to
write bad code is a good idea.
It wouldn't stay bad for long! Because if the intention was to declare
two pointers, then it's easier to see that this is wrong.
So basically, the suggestion would change some very minor things -
mostly in subjective ways - and not actually do anything for aspects
of the language where there is more of a consensus that C is sub-
optimal. And for this, you would want a fundamental change to one of
the most used operators in all C code!
Obviously you can't change prefix * now. A postfix /alternative/, in addition to prefix *, could have been introduced decades ago. So by the
time /you/ encountered C, you might have been using the latter.
On 21/10/2026 03:04, bart wrote:
Here, one problem is that there are 3 types that I don't know and
would have to look up.
Incorrect.
That signed char return is unusual; why not 'int'? (How would you even
print an 'err_t' value anyway)?
It seems that yet again, you need an explanation of fundamental points
of software development.˙ Today's lesson is on "abstraction".
Maybe on some targets (of this portable library), err_t is "signed
char".
It is also nice to know that it can be used in a switch, and cast to an
int for printf.
Or look at the "ip_addr_t" type.˙ It happens, at the moment, to be a
struct.˙ But it might have been a union.˙ The size and contents of the struct depend on details of how the library is built - whether it has support for ipv4, ipv6, or both.˙ Maybe a future version will also
support ipv8, or ipv5 (I've heard some people are trying to make an IP protocol that covers more than IPv4, but without most of the
complicating additional features of IPv6).˙ It is an abstract type - you
use it without knowing the details.
Lawrence D?Oliveiro pisze:
t to end each case-sequence in a switch statement with
a break-statement: put the break at the same indentation level as the
case-clause as well as the switch-expression. That way, you can scan
your eye down a single line f
some time ago i was saying what the proper switch should like
(imo, but im not sure if my conclusions are anough to take is a s proven)
case {} case {}˙ case {} otherwise {}
its indeed sorta needed becouse case in fact are ifs
(not if-elses)˙ (so some in fact could write
if {} if {} if {} otherwise {}
its the same)
˙the problem is you˙ got no group alse
and here this otherwise need to check all ifs
"or" them and use group else for them
this could be written in few ways, but my case case case otherwise names it could also do
if {} or if {} or if {} else {}
so either you need logic operators here or predefined constructs like otherwise (maybe both)
and that should be included not switch wchich is bad imo
other way is to define distionary more as data construct
dict {
'mental'˙ {/* 1 */}
'reductionists' {/* 2 */}
'suck' {/* 3 */}
}
then you could use
dict('reductionists')
to yeld to˙ /* 2 */
this second one parallels to switch keyword
so c switch mixes them both in bad way..they should be spitet and
upbuild as showed ;c
thats my conclusion as switch topic as far by now ;c
In article <11baah2$3te3v$1@dont-email.me>,
David Brown <david.brown@hesbynett.no> wrote:
On 20/10/2026 21:24, Dan Cross wrote:
In article <11b7k22$2v8e5$1@dont-email.me>, bart <bc@freeuk.com> wrote: >>>> [snip]
(There was a LOT of antipathy towards my idea to fix the common case of >>>> 'loop-break' clashing with 'switch-break', BECAUSE it did not fix the
problem of nested loop-break, which is uncommon, even though that wasn't >>>> the aim.)
Those are two different things. No one disagrees with you that
"nested break from a switch inside of a loop" is relatively more
common than other variants.
Quibble - that is not established to my satisfaction. I am not
convinced that wanting a nested break for "switch inside loop" is more
common than wanting it for "loop inside loop". So I neither agree nor
disagree with that claim. I don't, however, think it matters much -
both are situations that turn up sometimes in code, and definitive
answers are neither possible nor useful.
Ok, that's fair; I shouldn't say "no one disagrees".
[snip]
There are plenty of languages that can do this kind of thing
that are not C and have syntax and semantics closer to what you
seem to want. Here's an example in Rust:
pub trait TimerHandle { ... }
fn CreateTimer<T>(
timer_name: &str,
period: std::time::Duration,
auto_reload: bool,
timer_id: T,
handler: fn(&dyn TimerHandle),
) -> Result<Timer<T>, TimerError>
I didn't know what an `UBaseType_t` is, and while "autoreload"
sounded pretty intuitive, I wasn't sure about the semantics, so
I looked it up (the example comes from `FreeRTOS`). In this
context, it is a boolean saying whether the timer should repeat
with the given periodicity, or whether it is a one-shot.
FreeRTOS is written in C90 - a mistake, IMHO - and thus does not use
bool. Instead, it uses constants pdTRUE and pdFALSE of type
UBaseType_t. UBaseType_t is a type that is dependent on the target -
usually it is either 16-bit or 32-bit. But of course it doesn't matter
what the underlying types are - you use the typedef names, and the
documented constants.
Thanks for the context. Your point that the underlying type
doesn't matter is salient: it's opaque to the programmer, but
99% of the time the programmer doesn't need to worry about the
details.
The timer_id is opaque to the timer, and it looks like it's used
to facilitating the handler accessing timer-specific data. In
C, passing it as a `void *` is used as a way to get a poor-man's
overloading. But Rust has generics, I just made it generic over
some type T.
FreeRTOS uses "void *" to mean "pointer to internal structure that you
shouldn't be messing with". It uses this far too often, and is, IMHO, a
poor design choice. (I also dislike the silly Hungarian naming.) I
would much preferred if there had been :
struct Internal_Timer_Struct;
typedef struct Internal_Timer_Struct * timer_id_t;
and then the parameter "timer_id_t timer_id". So in a re-write, it
would not be a generic. (You might choose to use a generic for the
handler function type, so that handler callbacks could have parameters
of other types, but not for the timer id.)
I am using these declarations from FreeRTOS (and LWIP) to demonstrate
the use of function typedefs in massively popular codebases, not to
claim FreeRTOS is a paradigm of C code design!
Oh interesting; in this case, I had assumed it was treated as
a callback-specific type so one could plumb extra context into
the handler; the documentation I saw suggested it could be used
by the handler to disambiguate several timers reusing the same
handler function.
For example:
[snip]
Note this is decently complex behavior, but it's actually quite
intuitive from the name and the type.
You have got a very clear picture here, much of it from the names of the
types. For a Rust programmer, you give a good impression of experience
with C :-)
I've been known to dabble.
The only mistake you made is that programmers working on systems using
FreeRTOS and the like, have a fear and loathing of "malloc", have never
heard of "abort()", and do not join our threads because they all run
until the power is switched off.
Ha, fair; that was just a made-up example, based on other thread
libraries I have used (in C). I didn't mean for it to be
interpreted strictly in the context of FreeRTOS! :-D
[snip]
Or just have :
fnptr pc = first;
fnptr *pcptr = &pc;
I don't see a need for "uintptr_t", except so that you have to have
casts like Bart had.
Yes. But I wanted to remain faithful to his original, to show
that one could write a more-or-less exact transliteration in C
that was extremely similar to his chosen syntax.
[Snip a bunch of Rust code; the point of which being that
bart need not complain about lack of an alternative to C]
On 21/10/2026 12:21, David Brown wrote:
On 21/10/2026 03:04, bart wrote:
Here, one problem is that there are 3 types that I don't know and
would have to look up.
Incorrect.
If I wanted to use function from a language that is not C and for which nobody has yet created a set of bindings, then I would have to
investigate every single abstract type.
Even then, I might find that a year later, 'err_t' has been defined to
be something slightly different. Standard types are easier to deal with
and more likely to be stable.
On 21/10/2026 12:21, David Brown wrote:
On 21/10/2026 03:04, bart wrote:
Here, one problem is that there are 3 types that I don't know and
would have to look up.
Incorrect.
If I wanted to use function from a language that is not C and for which >nobody has yet created a set of bindings, then I would have to
investigate every single abstract type.
Even then, I might find that a year later, 'err_t' has been defined to
be something slightly different. Standard types are easier to deal with
and more likely to be stable.
That signed char return is unusual; why not 'int'? (How would you even
print an 'err_t' value anyway)?
It seems that yet again, you need an explanation of fundamental points
of software development.˙ Today's lesson is on "abstraction".
OK. I've just looked at several graphics libraries. Those have chosen to
use predominantly standard C types for function return values. And
standard C types for numeric arguments.
Sometimes they might be prefixed, eg. GL_int, SDL_bool, probably as >abstraction from the vagaries of standard C.
It seems a trend to invent pointless extra types for everything. In C >itself, there are about 35 denotations for integer types, and that's
before you get into clock_t, time_t, offset_t and everything else.
In general most boil down to one of i32 u32 i64 u64.
So you can go over the top with abstraction.
Maybe on some targets (of this portable library), err_t is "signed
char".
Why not define it on top of 'int'? Is it likely that large numbers of
error codes are going to be stored within structs and arrays so that the >size must be minimal?
It is also nice to know that it can be used in a switch, and cast to an
int for printf.
How would you know that? I thought it was abstract! Maybe err_t is a
small struct.
Or look at the "ip_addr_t" type.˙ It happens, at the moment, to be a
struct.˙ But it might have been a union.˙ The size and contents of the
struct depend on details of how the library is built - whether it has
support for ipv4, ipv6, or both.˙ Maybe a future version will also
support ipv8, or ipv5 (I've heard some people are trying to make an IP
protocol that covers more than IPv4, but without most of the
complicating additional features of IPv6).˙ It is an abstract type - you
use it without knowing the details.
I haven't said much about that. It is a struct so some username is
needed. I renamed it to IP_addr in my example.
But I'm not sure it needs the _t suffix. (Is it a thing now for every >typedef name to need _t?)
I notice however that the argument is a pointer: if ip_addr_t* values
are commonly passed around, I would put an abstraction around that.
(However that's partly because how my language works is different; to
access a member of the struct, I don't need to know if the type of X is
an actual struct or is a pointer to one; I write X.addr in both cases.)
In article <11baiuc$11ac$1@dont-email.me>, bart <bc@freeuk.com> wrote:
On 21/10/2026 12:21, David Brown wrote:
On 21/10/2026 03:04, bart wrote:
Here, one problem is that there are 3 types that I don't know and
would have to look up.
Incorrect.
If I wanted to use function from a language that is not C and for which
nobody has yet created a set of bindings, then I would have to
investigate every single abstract type.
That is true of every programming language.
Even then, I might find that a year later, 'err_t' has been defined to
be something slightly different. Standard types are easier to deal with
and more likely to be stable.
That is also true of every programming language.
You can write some library in BartM or whatever language you
like, and someone might write a binding to call it from, say,
Pascal; and then a year down the road, you might change your
compiler (since I gather you don't bother with a well-defined
ABI, based on your not seeming to understand them
Welcome to programming. It's Hard(TM).
In general most boil down to one of i32 u32 i64 u64.
Judicious use of types can render entire categories of errors
unexpressible. Alexis King wrote a wonderful post about this,
expressed using Haskell, but the general principles apply more
broadly.
It is also nice to know that it can be used in a switch, and cast to an
int for printf.
How would you know that? I thought it was abstract! Maybe err_t is a
small struct.
Because the documentation about it tells you that you can: "The
type `err_t` is used to represent errors. It can be cast to
`int`." Really, this is table-stakes software development.
On 21/10/2026 16:37, Dan Cross wrote:
You can write some library in BartM or whatever language you
like, and someone might write a binding to call it from, say,
Pascal; and then a year down the road, you might change your
compiler (since I gather you don't bother with a well-defined
ABI, based on your not seeming to understand
You still don't get what an ABI is.
bart <bc@freeuk.com> writes:
On 21/10/2026 16:37, Dan Cross wrote:
You can write some library in BartM or whatever language you
like, and someone might write a binding to call it from, say,
Pascal; and then a year down the road, you might change your
compiler (since I gather you don't bother with a well-defined
ABI, based on your not seeming to understand
You still don't get what an ABI is.
Please, enlighten us. Be specific. What exactly
does the term ABI mean to you?
On 21/10/2026 18:21, Scott Lurndal wrote:
bart <bc@freeuk.com> writes:
On 21/10/2026 16:37, Dan Cross wrote:
You can write some library in BartM or whatever language you
like, and someone might write a binding to call it from, say,
Pascal; and then a year down the road, you might change your
compiler (since I gather you don't bother with a well-defined
ABI, based on your not seeming to understand
You still don't get what an ABI is.
Please, enlighten us. Be specific. What exactly
does the term ABI mean to you?
It's what I have to deal with in a compiler back-end if I want to
support an FFI in a language.
It's not the same problem as using that FFI to write a set of bindings >corresponding with a particular API.
The latter problem needs to be solved even if there was no back-end and
no ABI to deal with (eg. transpiling to another language, or lowering to >some VM).
I don't why I'm bothering, since somebody will find another stick to
beat me over the head with or to somehow try to catch me out, but here
is an example of a function inside MSVCRT.DLL..
In the C API (ie. stdio.h) it will be expressed like this:
int puts(const char*);
In my FFI and in my syntax, it is expressed like this:
func puts (ichar)i32
So, this is 'creating a binding'. This can be done manually for this
one-off example. It's not perfect: on my platform, the C parameter has
'ref i8' type, but mine is more like 'ref u8'.
At this point, the ABI doesn't come into it.
That becomes relevant within the backend for a particular target and >platform.
So for this call:
puts(s)
the ABI for x64 running Windows will tell me that 's' must be passed in
rcx, the stack needs a shadow space, it needs to be 16-byte aligned, and
the 32-bit result is placed in eax.
For ARM64 running Linux (SYS V), then 's' is passed in x0, and the
result placed in w0. The stack will always properly aligned.
The only overlap in API/ABI may be to do with details of how structs may
be laid out in memory. But generally, C APIs will just follow the C
rules; I don't consider it an ABI thing. It would be something to deal
with even if no ABI existed and no native code was generated.
For my purposes, ABI is about calling conventions. ABI references may
cover a lot more (eg. for SYS V which likes to make everything as >complicated as possible).
So, now tell me what I've got wrong.
On 21/10/2026 15:22, Dan Cross wrote:
[snip]
Actually, I have mixed these up, and you are correct - the void* id is >user-assigned, and you use it as you wish. There are other places in >FreeRTOS where pointer types get "erased" and reduced to void* >unnecessarily, but this was not one of them. (In my poor defence, the >FreeRTOS code I have doesn't use timers, and the bits it does use -
threads and queues, mainly - is abstracted to a C++ interface.)
It was interesting to see the Rust code, but it made one thing clear to
me - Rust should be used for writing Rust code, and not for writing C
code in Rust syntax.
[snip]
You still don't get what an ABI is.
On 21/10/2026 18:21, Scott Lurndal wrote:
bart <bc@freeuk.com> writes:
On 21/10/2026 16:37, Dan Cross wrote:
You can write some library in BartM or whatever language you
like, and someone might write a binding to call it from, say,
Pascal; and then a year down the road, you might change your
compiler (since I gather you don't bother with a well-defined
ABI, based on your not seeming to understand
You still don't get what an ABI is.
Please, enlighten us. Be specific. What exactly
does the term ABI mean to you?
It's what I have to deal with in a compiler back-end if I want to
support an FFI in a language.
In article <11baur1$63id$1@dont-email.me>, bart <bc@freeuk.com> wrote:And Wow, your reply is exactly the kind I expected!
So, now tell me what I've got wrong.
Wow. You really, truly, have no idea how any of this works. I
don't even know where to begin. You just throw around words but
have no idea what they mean in context.
It's breathtaking, really.
bart <bc@freeuk.com> writes:
On 21/10/2026 18:21, Scott Lurndal wrote:
bart <bc@freeuk.com> writes:
On 21/10/2026 16:37, Dan Cross wrote:
You can write some library in BartM or whatever language you
like, and someone might write a binding to call it from, say,
Pascal; and then a year down the road, you might change your
compiler (since I gather you don't bother with a well-defined
ABI, based on your not seeming to understand
You still don't get what an ABI is.
Please, enlighten us. Be specific. What exactly
does the term ABI mean to you?
It's what I have to deal with in a compiler back-end if I want to
support an FFI in a language.
Ah, so you don't know what an ABI is.
An Application Binary Interface (ABI) is a
low-level contract in computer science that
defines how two compiled binary program modules
interact with each other at the machine-code level.
If you want your compiler to leverage existing libraries
and/or code written in another language, you need to follow
the platform ABI. It is that simple.
Whether you like it or not, is completely irrelevent.
The stack pointer alignment requirement should be obvious.
On 21/10/2026 19:38, Dan Cross wrote:
In article <11baur1$63id$1@dont-email.me>, bart <bc@freeuk.com> wrote:
So, now tell me what I've got wrong.
Wow. You really, truly, have no idea how any of this works. I
don't even know where to begin. You just throw around words but
have no idea what they mean in context.
It's breathtaking, really.
And Wow, your reply is exactly the kind I expected!
Of course, you're not going to tell me what API means versus ABI, and
you're not going to answer my question about what I've got wrong.
Because actually you don't know.
This was apparent from things you've said in the past.
I have actually wondered what you're doing here, and this appears to be
it: being hostile, patronising, condescending and constantly taking the >contrary view no matter what.
In other words, being a troll.
In article <11bb47i$889c$1@dont-email.me>, bart <bc@freeuk.com> wrote:
On 21/10/2026 19:38, Dan Cross wrote:
In article <11baur1$63id$1@dont-email.me>, bart <bc@freeuk.com> wrote:
So, now tell me what I've got wrong.
Wow. You really, truly, have no idea how any of this works. I
don't even know where to begin. You just throw around words but
have no idea what they mean in context.
It's breathtaking, really.
And Wow, your reply is exactly the kind I expected!
Of course, you're not going to tell me what API means versus ABI, and
you're not going to answer my question about what I've got wrong.
Honestly? No, I'm not. It's clear that if I tried, you would
either not understand, or deliberately ignore it so you could
blindly continue in your self-imposed ignorance.
Because actually you don't know.
Umm.....
This was apparent from things you've said in the past.
You know, it's one thing to be ignorant yourself. It's quite
another to project that onto others.
I have actually wondered what you're doing here, and this appears to be
it: being hostile, patronising, condescending and constantly taking the
contrary view no matter what.
In other words, being a troll.
It's apparent that you really, truly, do not understand why so
many others seem like they are "having a go" at you. I actually
feel kind of bad for you.
On 21/10/2026 21:36, Dan Cross wrote:
In article <11bb47i$889c$1@dont-email.me>, bart <bc@freeuk.com> wrote:
On 21/10/2026 19:38, Dan Cross wrote:
In article <11baur1$63id$1@dont-email.me>, bart <bc@freeuk.com> wrote: >>>
So, now tell me what I've got wrong.
Wow. You really, truly, have no idea how any of this works. I
don't even know where to begin. You just throw around words but
have no idea what they mean in context.
It's breathtaking, really.
And Wow, your reply is exactly the kind I expected!
Of course, you're not going to tell me what API means versus ABI, and
you're not going to answer my question about what I've got wrong.
Honestly? No, I'm not. It's clear that if I tried, you would
either not understand, or deliberately ignore it so you could
blindly continue in your self-imposed ignorance.
Because actually you don't know.
Umm.....
This was apparent from things you've said in the past.
You know, it's one thing to be ignorant yourself. It's quite
another to project that onto others.
I've seen zero evidence that you know anything about the matter. Just >bluster.
Just start using the switch statement. It's useful in very very very
many cases.
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
fir wrote:
Lawrence D?Oliveiro pisze:Just start using the switch statement. It's useful in very very very
t to end each case-sequence in a switch statement with
a break-statement: put the break at the same indentation level as the
case-clause as well as the switch-expression. That way, you can scan
your eye down a single line f
some time ago i was saying what the proper switch should like
(imo, but im not sure if my conclusions are anough to take is a s proven)
case {} case {}˙ case {} otherwise {}
its indeed sorta needed becouse case in fact are ifs
(not if-elses)˙ (so some in fact could write
if {} if {} if {} otherwise {}
its the same)
˙˙the problem is you˙ got no group alse
and here this otherwise need to check all ifs
"or" them and use group else for them
this could be written in few ways, but my case case case otherwise
names it
could also do
if {} or if {} or if {} else {}
so either you need logic operators here or predefined constructs like
otherwise (maybe both)
and that should be included not switch wchich is bad imo
other way is to define distionary more as data construct
dict {
'mental'˙ {/* 1 */}
'reductionists' {/* 2 */}
'suck' {/* 3 */}
}
then you could use
dict('reductionists')
to yeld to˙ /* 2 */
this second one parallels to switch keyword
so c switch mixes them both in bad way..they should be spitet and
upbuild as showed ;c
thats my conclusion as switch topic as far by now ;c
many cases. You'll get the hang of it right away. Next, it doesn't just
test variable type 'int', also notably 'char', among others.
On 21/10/2026 22:02, Chris M. Thomasson wrote:
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
I don't program for POSIX, so I don't care. The same applies to most
code that is used in connection with FreeRTOS, or LWIP. (Of course
there will be some overlap - bits of code that are intended to run on a >microcontroller but tested with code running native on a PC.)
I don't know if the "_t" convention for type identifiers started with
POSIX, but it has certainly far outgrown POSIX. And I think the smart
folks behind POSIX know this, and will not assume that just because they >pick a new type name ending in _t, it will not conflict with some user
code. As C doesn't have namespaces, there is always a risk of
conflicting names - you just have to try to avoid clashes in things you
are likely to see.
On 21/10/2026 21:36, Dan Cross wrote:
In article <11bb47i$889c$1@dont-email.me>, bart˙ <bc@freeuk.com> wrote:
On 21/10/2026 19:38, Dan Cross wrote:
In article <11baur1$63id$1@dont-email.me>, bart˙ <bc@freeuk.com> wrote: >>>
So, now tell me what I've got wrong.
Wow.˙ You really, truly, have no idea how any of this works.˙ I
don't even know where to begin.˙ You just throw around words but
have no idea what they mean in context.
It's breathtaking, really.
And Wow, your reply is exactly the kind I expected!
Of course, you're not going to tell me what API means versus ABI, and
you're not going to answer my question about what I've got wrong.
Honestly?˙ No, I'm not.˙ It's clear that if I tried, you would
either not understand, or deliberately ignore it so you could
blindly continue in your self-imposed ignorance.
Because actually you don't know.
Umm.....
This was apparent from things you've said in the past.
You know, it's one thing to be ignorant yourself.˙ It's quite
another to project that onto others.
I've seen zero evidence that you know anything about the matter. Just bluster.
I have actually wondered what you're doing here, and this appears to be
it: being hostile, patronising, condescending and constantly taking the
contrary view no matter what.
In other words, being a troll.
It's apparent that you really, truly, do not understand why so
many others seem like they are "having a go" at you.˙ I actually
feel kind of bad for you.
If you don't know this stuff, that would be perfectly fine, not everyone
is into compilers.
But refusing to admit that you mixed up API/ABI and instead gaslighting others into thinking they're the ones in the wrong is unacceptable and childish.
I've looked at the 40 or so posts you've made in the last few days, half
of them were replies to me, all unpleasant exchanges.
This is just persecution, constantly attacking and belittling at the personal level. Maybe you're some sick fuck and and you get a kick out
of it, then you should get help together with JP, that other wonderful person.
On 21/10/2026 22:02, Chris M. Thomasson wrote:
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
I don't program for POSIX, so I don't care. The same applies to most
code that is used in connection with FreeRTOS, or LWIP. (Of course
there will be some overlap - bits of code that are intended to run on a microcontroller but tested with code running native on a PC.)
I don't know if the "_t" convention for type identifiers started with
POSIX, but it has certainly far outgrown POSIX. And I think the smart
folks behind POSIX know this, and will not assume that just because they pick a new type name ending in _t, it will not conflict with some user
code. As C doesn't have namespaces, there is always a risk of
conflicting names - you just have to try to avoid clashes in things you
are likely to see.
Anyway, the point is that the `_t` convention predates POSIX
(and ANSI C) by about a decade.
On 2026-10-22, David Brown <david.brown@hesbynett.no> wrote:
On 21/10/2026 22:02, Chris M. Thomasson wrote:
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
I don't program for POSIX, so I don't care. The same applies to most
code that is used in connection with FreeRTOS, or LWIP. (Of course
there will be some overlap - bits of code that are intended to run on a
microcontroller but tested with code running native on a PC.)
I don't know if the "_t" convention for type identifiers started with
POSIX, but it has certainly far outgrown POSIX. And I think the smart
folks behind POSIX know this, and will not assume that just because they
pick a new type name ending in _t, it will not conflict with some user
code. As C doesn't have namespaces, there is always a risk of
conflicting names - you just have to try to avoid clashes in things you
are likely to see.
These namespace declarations are really just a "heads up". POSIX
isn't saying, don't have an identifier ending in _t in a namespace
shared by typedefs. Rather, it is saying that new typedefs appearing
in POSIX will be in that namespace.
Consider this argument: whenever POSIX or ISO C introduces a new
public identifier, it's necessarily going to start with "a", or else if
not, then with "b", or else with "c", ... or else with "z"
or perhaps the underscore.
That doesn't mean you stop using identifiers in programming.
"nullptr" is now a keyword, previously a valid identifier not in
any proclaimed reserved namespace. Progrems which used it have
to be changed to work with the newer language.
Avoiding proclaimed namespaces will not protect you from clashes;
only from clashes that would occur in those namespaces.
Some spaces like _t are too attractive to avoid, because they are tied
to an important, popular convention that everyone understands,
and the benefits outweigh the unrealized risk of a future clash.
On 2026-10-22, David Brown <david.brown@hesbynett.no> wrote:
On 21/10/2026 22:02, Chris M. Thomasson wrote:
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
I don't program for POSIX, so I don't care. The same applies to most
code that is used in connection with FreeRTOS, or LWIP. (Of course
there will be some overlap - bits of code that are intended to run on a
microcontroller but tested with code running native on a PC.)
I don't know if the "_t" convention for type identifiers started with
POSIX, but it has certainly far outgrown POSIX. And I think the smart
folks behind POSIX know this, and will not assume that just because they
pick a new type name ending in _t, it will not conflict with some user
code. As C doesn't have namespaces, there is always a risk of
conflicting names - you just have to try to avoid clashes in things you
are likely to see.
These namespace declarations are really just a "heads up". POSIX
isn't saying, don't have an identifier ending in _t in a namespace
shared by typedefs. Rather, it is saying that new typedefs appearing
in POSIX will be in that namespace.
Consider this argument: whenever POSIX or ISO C introduces a new
public identifier, it's necessarily going to start with "a", or else if
not, then with "b", or else with "c", ... or else with "z"
or perhaps the underscore.
That doesn't mean you stop using identifiers in programming.
"nullptr" is now a keyword, previously a valid identifier not in
any proclaimed reserved namespace. Progrems which used it have
to be changed to work with the newer language.
Avoiding proclaimed namespaces will not protect you from clashes;
only from clashes that would occur in those namespaces.
Some spaces like _t are too attractive to avoid, because they are tied
to an important, popular convention that everyone understands,
and the benefits outweigh the unrealized risk of a future clash.
These namespace declarations are really just a "heads up". POSIX[...]
isn't saying, don't have an identifier ending in _t in a namespace
shared by typedefs. Rather, it is saying that new typedefs appearing
in POSIX will be in that namespace.
Kaz Kylheku <046-301-5902@kylheku.com> writes:
[...]
These namespace declarations are really just a "heads up". POSIX[...]
isn't saying, don't have an identifier ending in _t in a namespace
shared by typedefs. Rather, it is saying that new typedefs appearing
in POSIX will be in that namespace.
No, it says that all conforming applications are required to avoid
symbols ending in "_t".
https://pubs.opengroup.org/onlinepubs/9799919799/xrat/V4_xsh_chap01.html B.2.11.1 Defined Types
The requirement that additional types defined in this section
end in "_t" was prompted by the problem of name space pollution.
It is difficult to define a type (where that type is not one
defined by POSIX.1-2024) in one header file and use it in another
without adding symbols to the name space of the program. To
allow implementors to provide their own types, all conforming
applications are required to avoid symbols ending in "_t",
which permits the implementor to provide additional types.
Because a major use of types is in the definition of structure
members, which can (and in many cases must) be added to the
structures defined in POSIX.1-2024, the need for additional
types is compelling.
Of course you don't have to avoid defining symbols ending with "_t"
if you don't want to, but if you do so you don't have a "conforming application" as far as POSIX is concerned.
It is, of course, an imperfect solution.
Kaz Kylheku <046-301-5902@kylheku.com> writes:
[...]
These namespace declarations are really just a "heads up". POSIX[...]
isn't saying, don't have an identifier ending in _t in a namespace
shared by typedefs. Rather, it is saying that new typedefs appearing
in POSIX will be in that namespace.
No, it says that all conforming applications are required to avoid
symbols ending in "_t".
Of course you don't have to avoid defining symbols ending with "_t"
if you don't want to, but if you do so you don't have a "conforming application" as far as POSIX is concerned.
On 10/22/2026 9:54 AM, Kaz Kylheku wrote:
On 2026-10-22, David Brown <david.brown@hesbynett.no> wrote:
On 21/10/2026 22:02, Chris M. Thomasson wrote:
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
I don't program for POSIX, so I don't care.˙ The same applies to most
code that is used in connection with FreeRTOS, or LWIP.˙ (Of course
there will be some overlap - bits of code that are intended to run on a
microcontroller but tested with code running native on a PC.)
Avoiding proclaimed namespaces will not protect you from clashes;
only from clashes that would occur in those namespaces.
Some spaces like _t are too attractive to avoid, because they are tied
to an important, popular convention that everyone understands,
and the benefits outweigh the unrealized risk of a future clash.
Touche. How about _this vs this_. I just use self and be done with it.
On 2026-10-22, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
Kaz Kylheku <046-301-5902@kylheku.com> writes:
[...]
These namespace declarations are really just a "heads up". POSIX[...]
isn't saying, don't have an identifier ending in _t in a namespace
shared by typedefs. Rather, it is saying that new typedefs appearing
in POSIX will be in that namespace.
No, it says that all conforming applications are required to avoid
symbols ending in "_t".
That concept is needed in order to make it the application's fault
when it suddenly fails to build because it's using foo_t, and
POSIX decides to introduced that into <sys/types.h>.
If you use _t, a clash may happen, and if it does, then since POSIX told-you-so, it must be your program that is nonconforming, and not the
POSIX has a defect or the implementation is nonconforming.
Of course you don't have to avoid defining symbols ending with "_t"
if you don't want to, but if you do so you don't have a "conforming
application" as far as POSIX is concerned.
This is okay if you have a grip on the nonconformances in the
application. You know where they are and have a way to be informed when
they turn into real problems and a plan for that situation.
Remember, a program that uses nullptr as a variable name was once
conforming. Through no change in the program whatsoever, it became nonconforming. Playing the conformance game in this area is largely
a fool's errand.
On 22/10/2026 21:46, Chris M. Thomasson wrote:
On 10/22/2026 9:54 AM, Kaz Kylheku wrote:
On 2026-10-22, David Brown <david.brown@hesbynett.no> wrote:
On 21/10/2026 22:02, Chris M. Thomasson wrote:
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
I don't program for POSIX, so I don't care.˙ The same applies to most
code that is used in connection with FreeRTOS, or LWIP.˙ (Of course
there will be some overlap - bits of code that are intended to run on a >>>> microcontroller but tested with code running native on a PC.)
Avoiding proclaimed namespaces will not protect you from clashes;
only from clashes that would occur in those namespaces.
Some spaces like _t are too attractive to avoid, because they are tied
to an important, popular convention that everyone understands,
and the benefits outweigh the unrealized risk of a future clash.
Touche. How about _this vs this_. I just use self and be done with it.
Imagine, just for a moment, that the rest of us are not privy to the
jumble of thoughts and ideas that jump around in your head.˙ I don't
have the context of what you are thinking about.˙ So I have no idea what
you mean by this.
Instead of posting random out-of-context snippets of thought, either
write posts that say what you are talking about, or don't bother.˙ (And
do /not/ imagine that posting reams of unconnected code is a useful alternative.)
If you are trying to say something about avoiding C++ keywords when
picking identifiers in C coding, say that.˙ If you are trying to say something about naming conventions for C++ class members, feel free to
talk about that too - in comp.lang.c++.˙ If you are trying to say
something else, say it.˙ Or drop it, if you prefer.
I like self.
void foo(struct foo* const self);
On Fri, 23 Oct 2026 14:21:15 -0700, Chris M. Thomasson wrote:
I like self.
void foo(struct foo* const self);
The trouble with a fixed name is, how do you refer to the instance of
an outer class?
On 10/23/2026 12:37 AM, David Brown wrote:
On 22/10/2026 21:46, Chris M. Thomasson wrote:
On 10/22/2026 9:54 AM, Kaz Kylheku wrote:
On 2026-10-22, David Brown <david.brown@hesbynett.no> wrote:
On 21/10/2026 22:02, Chris M. Thomasson wrote:
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
I don't program for POSIX, so I don't care.˙ The same applies to most >>>>> code that is used in connection with FreeRTOS, or LWIP.˙ (Of course
there will be some overlap - bits of code that are intended to run
on a
microcontroller but tested with code running native on a PC.)
Avoiding proclaimed namespaces will not protect you from clashes;
only from clashes that would occur in those namespaces.
Some spaces like _t are too attractive to avoid, because they are tied >>>> to an important, popular convention that everyone understands,
and the benefits outweigh the unrealized risk of a future clash.
Touche. How about _this vs this_. I just use self and be done with it.
Imagine, just for a moment, that the rest of us are not privy to the
jumble of thoughts and ideas that jump around in your head.˙ I don't
have the context of what you are thinking about.˙ So I have no idea
what you mean by this.
Instead of posting random out-of-context snippets of thought, either
write posts that say what you are talking about, or don't bother.
(And do /not/ imagine that posting reams of unconnected code is a
useful alternative.)
If you are trying to say something about avoiding C++ keywords when
picking identifiers in C coding, say that.˙ If you are trying to say
something about naming conventions for C++ class members, feel free to
talk about that too - in comp.lang.c++.˙ If you are trying to say
something else, say it.˙ Or drop it, if you prefer.
Or, Well,
_this
vs
this_
Are they both legal?
I like self.
void foo(struct foo* const self);
vs
void foo(struct foo* const _this);
void foo(struct foo* const this);
void foo(struct foo* const this_);
? For some reason I do not want to use this in C.
On 10/23/2026 3:40 PM, Lawrence D?Oliveiro wrote:
The trouble with a fixed name is, how do you refer to the instance
of an outer class?
Well, self can be internal to the API logic.
On Fri, 23 Oct 2026 18:33:56 -0700, Chris M. Thomasson wrote:
On 10/23/2026 3:40 PM, Lawrence D?Oliveiro wrote:
The trouble with a fixed name is, how do you refer to the instance
of an outer class?
Well, self can be internal to the API logic.
If ?self? refers to the current instance of the innermost class, how
do you refer to an instance of an outer class?
On Fri, 23 Oct 2026 18:33:56 -0700, Chris M. Thomasson wrote:
On 10/23/2026 3:40 PM, Lawrence D?Oliveiro wrote:
The trouble with a fixed name is, how do you refer to the instance
of an outer class?
Well, self can be internal to the API logic.
If ?self? refers to the current instance of the innermost class, how
do you refer to an instance of an outer class?
On 23/10/2026 23:21, Chris M. Thomasson wrote:
On 10/23/2026 12:37 AM, David Brown wrote:
On 22/10/2026 21:46, Chris M. Thomasson wrote:
On 10/22/2026 9:54 AM, Kaz Kylheku wrote:
On 2026-10-22, David Brown <david.brown@hesbynett.no> wrote:
On 21/10/2026 22:02, Chris M. Thomasson wrote:
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
I don't program for POSIX, so I don't care.˙ The same applies to most >>>>>> code that is used in connection with FreeRTOS, or LWIP.˙ (Of course >>>>>> there will be some overlap - bits of code that are intended to run >>>>>> on a
microcontroller but tested with code running native on a PC.)
Avoiding proclaimed namespaces will not protect you from clashes;
only from clashes that would occur in those namespaces.
Some spaces like _t are too attractive to avoid, because they are tied >>>>> to an important, popular convention that everyone understands,
and the benefits outweigh the unrealized risk of a future clash.
Touche. How about _this vs this_. I just use self and be done with it.
Imagine, just for a moment, that the rest of us are not privy to the
jumble of thoughts and ideas that jump around in your head.˙ I don't
have the context of what you are thinking about.˙ So I have no idea
what you mean by this.
Instead of posting random out-of-context snippets of thought, either
write posts that say what you are talking about, or don't bother.
(And do /not/ imagine that posting reams of unconnected code is a
useful alternative.)
If you are trying to say something about avoiding C++ keywords when
picking identifiers in C coding, say that.˙ If you are trying to say
something about naming conventions for C++ class members, feel free
to talk about that too - in comp.lang.c++.˙ If you are trying to say
something else, say it.˙ Or drop it, if you prefer.
Or, Well,
_this
vs
this_
Are they both legal?
What do you mean, "legal" ?˙ Identifiers in C can start with any letter (including most Unicode "letters") or underscore, or any other implementation-defined characters.˙ Subsequent characters can be any of these or a normal digit from the basic source character set.
The only identifiers you may not use are ones that match keywords.
There are various patterns that are "reserved", depending on header
usage, but using them is still "legal".˙ The main ones to avoid are identifiers starting with two underscores, or one underscore and a
capital letter.
I like self.
void foo(struct foo* const self);
vs
void foo(struct foo* const _this);
void foo(struct foo* const this);
void foo(struct foo* const this_);
? For some reason I do not want to use this in C.
Use whichever you like.˙ I would personally avoid using an identifier in
C that matches a keyword (or "contextual keyword") in C++, to make it
easier to re-use the same code in C++.˙ But you don't have to do the same.
On 10/24/2026 3:58 AM, David Brown wrote:
On 23/10/2026 23:21, Chris M. Thomasson wrote:
On 10/23/2026 12:37 AM, David Brown wrote:
On 22/10/2026 21:46, Chris M. Thomasson wrote:
On 10/22/2026 9:54 AM, Kaz Kylheku wrote:Imagine, just for a moment, that the rest of us are not privy to the
On 2026-10-22, David Brown <david.brown@hesbynett.no> wrote:
On 21/10/2026 22:02, Chris M. Thomasson wrote:
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
I don't program for POSIX, so I don't care.˙ The same applies to >>>>>>> most
code that is used in connection with FreeRTOS, or LWIP.˙ (Of course >>>>>>> there will be some overlap - bits of code that are intended to
run on a
microcontroller but tested with code running native on a PC.)
Avoiding proclaimed namespaces will not protect you from clashes;
only from clashes that would occur in those namespaces.
Some spaces like _t are too attractive to avoid, because they are >>>>>> tied
to an important, popular convention that everyone understands,
and the benefits outweigh the unrealized risk of a future clash.
Touche. How about _this vs this_. I just use self and be done with it. >>>>
jumble of thoughts and ideas that jump around in your head.˙ I don't
have the context of what you are thinking about.˙ So I have no idea
what you mean by this.
Instead of posting random out-of-context snippets of thought, either
write posts that say what you are talking about, or don't bother.
(And do /not/ imagine that posting reams of unconnected code is a
useful alternative.)
If you are trying to say something about avoiding C++ keywords when
picking identifiers in C coding, say that.˙ If you are trying to say
something about naming conventions for C++ class members, feel free
to talk about that too - in comp.lang.c++.˙ If you are trying to say
something else, say it.˙ Or drop it, if you prefer.
Or, Well,
_this
vs
this_
Are they both legal?
What do you mean, "legal" ?˙ Identifiers in C can start with any
letter (including most Unicode "letters") or underscore, or any other
implementation-defined characters.˙ Subsequent characters can be any
of these or a normal digit from the basic source character set.
The only identifiers you may not use are ones that match keywords.
There are various patterns that are "reserved", depending on header
usage, but using them is still "legal".˙ The main ones to avoid are
identifiers starting with two underscores, or one underscore and a
capital letter.
I like self.
void foo(struct foo* const self);
vs
void foo(struct foo* const _this);
void foo(struct foo* const this);
void foo(struct foo* const this_);
? For some reason I do not want to use this in C.
Use whichever you like.˙ I would personally avoid using an identifier
in C that matches a keyword (or "contextual keyword") in C++, to make
it easier to re-use the same code in C++.˙ But you don't have to do
the same.
_this good, _This bad?
_this good, _This bad?
On 25/10/2026 05:42, Chris M. Thomasson wrote:
On 10/24/2026 3:58 AM, David Brown wrote:
On 23/10/2026 23:21, Chris M. Thomasson wrote:
On 10/23/2026 12:37 AM, David Brown wrote:
On 22/10/2026 21:46, Chris M. Thomasson wrote:
On 10/22/2026 9:54 AM, Kaz Kylheku wrote:
On 2026-10-22, David Brown <david.brown@hesbynett.no> wrote:
On 21/10/2026 22:02, Chris M. Thomasson wrote:
On 10/21/2026 5:17 AM, David Brown wrote:
[...]
*_t intrudes into POSIX.
I don't program for POSIX, so I don't care.˙ The same applies to >>>>>>>> most
code that is used in connection with FreeRTOS, or LWIP.˙ (Of course >>>>>>>> there will be some overlap - bits of code that are intended to >>>>>>>> run on a
microcontroller but tested with code running native on a PC.)
Avoiding proclaimed namespaces will not protect you from clashes; >>>>>>> only from clashes that would occur in those namespaces.
Some spaces like _t are too attractive to avoid, because they are >>>>>>> tied
to an important, popular convention that everyone understands,
and the benefits outweigh the unrealized risk of a future clash. >>>>>>>
Touche. How about _this vs this_. I just use self and be done with >>>>>> it.
Imagine, just for a moment, that the rest of us are not privy to
the jumble of thoughts and ideas that jump around in your head.˙ I
don't have the context of what you are thinking about.˙ So I have
no idea what you mean by this.
Instead of posting random out-of-context snippets of thought,
either write posts that say what you are talking about, or don't
bother. (And do /not/ imagine that posting reams of unconnected
code is a useful alternative.)
If you are trying to say something about avoiding C++ keywords when >>>>> picking identifiers in C coding, say that.˙ If you are trying to
say something about naming conventions for C++ class members, feel
free to talk about that too - in comp.lang.c++.˙ If you are trying
to say something else, say it.˙ Or drop it, if you prefer.
Or, Well,
_this
vs
this_
Are they both legal?
What do you mean, "legal" ?˙ Identifiers in C can start with any
letter (including most Unicode "letters") or underscore, or any other
implementation-defined characters.˙ Subsequent characters can be any
of these or a normal digit from the basic source character set.
The only identifiers you may not use are ones that match keywords.
There are various patterns that are "reserved", depending on header
usage, but using them is still "legal".˙ The main ones to avoid are
identifiers starting with two underscores, or one underscore and a
capital letter.
I like self.
void foo(struct foo* const self);
vs
void foo(struct foo* const _this);
void foo(struct foo* const this);
void foo(struct foo* const this_);
? For some reason I do not want to use this in C.
Use whichever you like.˙ I would personally avoid using an identifier
in C that matches a keyword (or "contextual keyword") in C++, to make
it easier to re-use the same code in C++.˙ But you don't have to do
the same.
_this good, _This bad?
You figure it out.˙ I'm done trying to understand your silly little
posts and silly little questions, and then spoon-feed you basics about
the C language.
if {} or if {} or if {} else {}
fir pisze:
if {} or if {} or if {} else {}
this form in fact is not bad, it simply showst two things
1) you may use or outside the if clause (if this () can be named clause)
2) else in fact work on logical group but ias sole if is alos a case of logical group so else work on it sole in special case
otherwiste thse keywords here if or and else are quite 'legit'
if () {}
or if () {}
or if() {}
else {}
seems quite legit and it seem to ba a switchExcellent. A great thing about this is, this can also be legal C, that
On 26/10/2026 12:07, fir wrote:
fir pisze:Excellent. A great thing about this is, this can also be legal C, that
if {} or if {} or if {} else {}
this form in fact is not bad, it simply showst two things
1) you may use or outside the if clause (if this () can be named clause)
2) else in fact work on logical group but ias sole if is alos a case
of logical group so else work on it sole in special case
otherwiste thse keywords here if or and else are quite 'legit'
if () {}
or if () {}
or if() {}
else {}
seems quite legit and it seem to ba a switch
works now, if you just precede with this:
˙ #define or else
bartc pisze:
On 26/10/2026 12:07, fir wrote:this wouldnt work imo as far as im aware becouse this last else dont
fir pisze:Excellent. A great thing about this is, this can also be legal C, that
if {} or if {} or if {} else {}
this form in fact is not bad, it simply showst two things
1) you may use or outside the if clause (if this () can be named clause) >>>
2) else in fact work on logical group but ias sole if is alos a case
of logical group so else work on it sole in special case
otherwiste thse keywords here if or and else are quite 'legit'
if () {}
or if () {}
or if() {}
else {}
seems quite legit and it seem to ba a switch
works now, if you just precede with this:
˙˙ #define or else
work on "group'
the last else is what i name "otherwise" (its else in all other case"You seem to have named it 'else' in your example. In any case it would
On 26/10/2026 12:20, fir wrote:
bartc pisze:
On 26/10/2026 12:07, fir wrote:this wouldnt work imo as far as im aware becouse this last else dont
fir pisze:Excellent. A great thing about this is, this can also be legal C,
if {} or if {} or if {} else {}
this form in fact is not bad, it simply showst two things
1) you may use or outside the if clause (if this () can be named
clause)
2) else in fact work on logical group but ias sole if is alos a case
of logical group so else work on it sole in special case
otherwiste thse keywords here if or and else are quite 'legit'
if () {}
or if () {}
or if() {}
else {}
seems quite legit and it seem to ba a switch
that works now, if you just precede with this:
˙˙ #define or else
work on "group'
This works fine:
˙˙˙ #define or else
˙˙˙ for (int i=0; i<=5; ++i)
˙˙˙˙˙˙˙ if˙˙˙ (i==1) {puts("One");}
˙˙˙˙˙˙˙ or if (i==2) {puts("Two");}
˙˙˙˙˙˙˙ or if (i==3) {puts("Three");}
˙˙˙˙˙˙˙ else˙˙˙˙˙˙˙˙ {puts("Other");}
Output is:
˙ Other
˙ One
˙ Two
˙ Three
˙ Other
˙ Other
The point is you eventually came up with syntax that is actually just C
but using 'or' in place of 'else'.
the last else is what i name "otherwise" (its else in all other case"You seem to have named it 'else' in your example. In any case it would
just be a slightly different choice of keyword; it buys you very little.
On Sat, 24 Oct 2026 21:42:50 -0700, Chris M. Thomasson wrote:
_this good, _This bad?
If asked ?how many letters are there in the English alphabet??, what
answer do you think (normal) people are more likely to give: ?26? or
?52??
I think the instinctive answer most people would give is ?26?.
bartc pisze:
On 26/10/2026 12:20, fir wrote:maybe try with like
bartc pisze:
On 26/10/2026 12:07, fir wrote:this wouldnt work imo as far as im aware becouse this last else dont
fir pisze:Excellent. A great thing about this is, this can also be legal C,
if {} or if {} or if {} else {}
this form in fact is not bad, it simply showst two things
1) you may use or outside the if clause (if this () can be named
clause)
2) else in fact work on logical group but ias sole if is alos a
case of logical group so else work on it sole in special case
otherwiste thse keywords here if or and else are quite 'legit'
if () {}
or if () {}
or if() {}
else {}
seems quite legit and it seem to ba a switch
that works now, if you just precede with this:
˙˙ #define or else
work on "group'
This works fine:
˙˙˙˙ #define or else
˙˙˙˙ for (int i=0; i<=5; ++i)
˙˙˙˙˙˙˙˙ if˙˙˙ (i==1) {puts("One");}
˙˙˙˙˙˙˙˙ or if (i==2) {puts("Two");}
˙˙˙˙˙˙˙˙ or if (i==3) {puts("Three");}
˙˙˙˙˙˙˙˙ else˙˙˙˙˙˙˙˙ {puts("Other");}
Output is:
˙˙ Other
˙˙ One
˙˙ Two
˙˙ Three
˙˙ Other
˙˙ Other
The point is you eventually came up with syntax that is actually just
C but using 'or' in place of 'else'.
the last else is what i name "otherwise" (its else in all other case"You seem to have named it 'else' in your example. In any case it would
just be a slightly different choice of keyword; it buys you very little.
case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
default˙ // 1 5 7 11 13
the default should run if none of above cases catch (as i remember coz i dont use switch) and˙ thse cases˙ should catch each time
im maybe talkong about some more general switch here
(abstract) it is more important then normal one - as thsi general covers various possible casesYou seem fixated on that 'or'. Either use 'else', or create 'or' as an
using if or you can implement i it
˙˙ if(x%2==0) {}
or if(x%3==0) {}
else {}
without or (or something analogic) as i understand if im not wrong you cant
On 26/10/2026 16:03, fir wrote:
bartc pisze:
On 26/10/2026 12:20, fir wrote:maybe try with like
bartc pisze:
On 26/10/2026 12:07, fir wrote:this wouldnt work imo as far as im aware becouse this last else dont
fir pisze:Excellent. A great thing about this is, this can also be legal C,
if {} or if {} or if {} else {}
this form in fact is not bad, it simply showst two things
1) you may use or outside the if clause (if this () can be named
clause)
2) else in fact work on logical group but ias sole if is alos a
case of logical group so else work on it sole in special case
otherwiste thse keywords here if or and else are quite 'legit'
if () {}
or if () {}
or if() {}
else {}
seems quite legit and it seem to ba a switch
that works now, if you just precede with this:
˙˙ #define or else
work on "group'
This works fine:
˙˙˙˙ #define or else
˙˙˙˙ for (int i=0; i<=5; ++i)
˙˙˙˙˙˙˙˙ if˙˙˙ (i==1) {puts("One");}
˙˙˙˙˙˙˙˙ or if (i==2) {puts("Two");}
˙˙˙˙˙˙˙˙ or if (i==3) {puts("Three");}
˙˙˙˙˙˙˙˙ else˙˙˙˙˙˙˙˙ {puts("Other");}
Output is:
˙˙ Other
˙˙ One
˙˙ Two
˙˙ Three
˙˙ Other
˙˙ Other
The point is you eventually came up with syntax that is actually just
C but using 'or' in place of 'else'.
the last else is what i name "otherwise" (its else in all other case"You seem to have named it 'else' in your example. In any case it
would just be a slightly different choice of keyword; it buys you
very little.
case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
No, cases '6' and '12' are also true for x%2==0. Unless you want these
to be non-exclusive?
default˙ // 1 5 7 11 13
the default should run if none of above cases catch (as i remember coz
i dont use switch) and˙ thse cases˙ should catch each time
OK. C doesn't have a direct syntax for this. But it does have if-else
chains for precisely this job. What is the problem with that? You can
write it like this if you like:
˙˙ if (0)
˙˙ else if (x%2==0) {}
˙˙ else if (x%3==0) {}
if you want consistency. There's no point in creating a slightly
different syntax for the same thing.
im maybe talkong about some more general switch here
What does 'switch' mean to you? It seems that every day it is something
with more and more capabilities and it gets more ambiguous. At some
point it will its own AI to divine your intentions.
˙but this general
(abstract) it is more important then normal one - as thsi generalYou seem fixated on that 'or'. Either use 'else', or create 'or' as an
covers various possible cases
using if or you can implement i it
˙˙˙ if(x%2==0) {}
or if(x%3==0) {}
else {}
without or (or something analogic) as i understand if im not wrong you
cant
alias as I suggested.
bartc pisze:
On 26/10/2026 16:03, fir wrote:
bartc pisze:
On 26/10/2026 12:20, fir wrote:maybe try with like
bartc pisze:
On 26/10/2026 12:07, fir wrote:this wouldnt work imo as far as im aware becouse this last else
fir pisze:Excellent. A great thing about this is, this can also be legal C, >>>>>> that works now, if you just precede with this:
if {} or if {} or if {} else {}
this form in fact is not bad, it simply showst two things
1) you may use or outside the if clause (if this () can be named >>>>>>> clause)
2) else in fact work on logical group but ias sole if is alos a >>>>>>> case of logical group so else work on it sole in special case
otherwiste thse keywords here if or and else are quite 'legit'
if () {}
or if () {}
or if() {}
else {}
seems quite legit and it seem to ba a switch
˙˙ #define or else
dont work on "group'
This works fine:
˙˙˙˙ #define or else
˙˙˙˙ for (int i=0; i<=5; ++i)
˙˙˙˙˙˙˙˙ if˙˙˙ (i==1) {puts("One");}
˙˙˙˙˙˙˙˙ or if (i==2) {puts("Two");}
˙˙˙˙˙˙˙˙ or if (i==3) {puts("Three");}
˙˙˙˙˙˙˙˙ else˙˙˙˙˙˙˙˙ {puts("Other");}
Output is:
˙˙ Other
˙˙ One
˙˙ Two
˙˙ Three
˙˙ Other
˙˙ Other
The point is you eventually came up with syntax that is actually
just C but using 'or' in place of 'else'.
the last else is what i name "otherwise" (its else in all other case" >>>> You seem to have named it 'else' in your example. In any case itwould just be a slightly different choice of keyword; it buys you
very little.
case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
No, cases '6' and '12' are also true for x%2==0. Unless you want these
to be non-exclusive?
default˙ // 1 5 7 11 13
the default should run if none of above cases catch (as i remember
coz i dont use switch) and˙ thse cases˙ should catch each time
OK. C doesn't have a direct syntax for this. But it does have if-else
chains for precisely this job. What is the problem with that? You can
write it like this if you like:
˙˙˙ if (0)
˙˙˙ else if (x%2==0) {}
˙˙˙ else if (x%3==0) {}
you want it the above to pront "divides by 2" "divides by 3" for 6 and
12 "divides by 2" for 4 8 and 'divided by 3" for 2 9 in case it not
divides by 2 or 3 pronts "no divides "
this above will not work for 6 for example as it only will prit "divides
by 2"
without or (or something analogic) as i understand if im not wrong youYou seem fixated on that 'or'. Either use 'else', or create 'or' as an
cant
alias as I suggested.
bartc pisze:
without or (or something analogic) as i understand if im not wrongYou seem fixated on that 'or'. Either use 'else', or create 'or' as an
you cant
alias as I suggested.
imo you should try to understand the example
for(int i = 1; i < 20; i++)
{
˙˙˙˙˙˙˙ if(x%2==0) printf("\n divides by 2");
˙˙˙˙ or if(x%3==0) printf("\n divides by 3");
˙˙˙˙ else˙ printf("\n no divides (by 2 or 3)");
}
you understand how this would work? i think you do
and how in normal c without this "or" it would look,
for exampel in your if else model?
On 26/10/2026 16:45, fir wrote:
bartc pisze:
without or (or something analogic) as i understand if im not wrongYou seem fixated on that 'or'. Either use 'else', or create 'or' as
you cant
an alias as I suggested.
imo you should try to understand the example
for(int i = 1; i < 20; i++)
{
˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n divides by 2");
˙˙˙˙˙ or if(x%3==0) printf("\n divides by 3");
˙˙˙˙˙ else˙ printf("\n no divides (by 2 or 3)");
}
you understand how this would work? i think you do
and how in normal c without this "or" it would look,
for exampel in your if else model?
Show me exactly what the output should be, when it is written like this:
˙˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n%d divides by 2", i);
˙˙˙˙˙˙ or if(x%3==0) printf("\n%d divides by 3", i);
˙˙˙˙˙˙ else˙ printf("\n%d no divides (by 2 or 3)", i);
You might also want to look at the FizzBuzz program.
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 wrongYou seem fixated on that 'or'. Either use 'else', or create 'or' as
you cant
an alias as I suggested.
imo you should try to understand the example
for(int i = 1; i < 20; i++)
{
˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n divides by 2");
˙˙˙˙˙ or if(x%3==0) printf("\n divides by 3");
˙˙˙˙˙ else˙ printf("\n no divides (by 2 or 3)");
}
you understand how this would work? i think you do
and how in normal c without this "or" it would look,
for exampel in your if else model?
Show me exactly what the output should be, when it is written like this:
˙˙˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n%d divides by 2", i);
˙˙˙˙˙˙˙ or if(x%3==0) printf("\n%d divides by 3", i);
˙˙˙˙˙˙˙ else˙ printf("\n%d no divides (by 2 or 3)", i);
You might also want to look at the FizzBuzz program.
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)
fir pisze:
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.
imo you should try to understand the example
for(int i = 1; i < 20; i++)
{
˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n divides by 2");
˙˙˙˙˙ or if(x%3==0) printf("\n divides by 3");
˙˙˙˙˙ else˙ printf("\n no divides (by 2 or 3)");
}
you understand how this would work? i think you do
and how in normal c without this "or" it would look,
for exampel in your if else model?
Show me exactly what the output should be, when it is written like this: >>>
˙˙˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n%d divides by 2", i);
˙˙˙˙˙˙˙ or if(x%3==0) printf("\n%d divides by 3", i);
˙˙˙˙˙˙˙ else˙ printf("\n%d no divides (by 2 or 3)", i);
You might also want to look at the FizzBuzz program.
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)
in fact i had more such in my mind
for(int i=0; i<20; i++)
{
printf("\n %d,i);
if(x%2==0) printf("\n divides by 2");
˙or if(x%3==0) printf("\n divides by 3");
˙else printf("\n no divides (by 2 or 3)");
}
so the output is
˙1
˙no divides (by 2 or 3)
˙2
˙divides by 2
˙3
˙divides by 3
˙4
˙divides by 2
˙5
˙no divides (by 2 or 3)
˙6
˙divides by 2
˙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
˙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
˙divides by 3
˙19
˙no divides (by 2 or 3)
On 26/10/2026 16:37, fir wrote:[...]
bartc pisze:
On 26/10/2026 16:03, fir wrote:
bartc pisze:
On 26/10/2026 12:20, fir wrote:
bartc pisze:
On 26/10/2026 12:07, fir wrote:
fir pisze:
if {} or if {} or if {} else {}
[...]if () {}
or if () {}
or if() {}
else {}
[...]˙˙˙˙ #define or else
˙˙˙˙ for (int i=0; i<=5; ++i)
˙˙˙˙˙˙˙˙ if˙˙˙ (i==1) {puts("One");}
˙˙˙˙˙˙˙˙ or if (i==2) {puts("Two");}
˙˙˙˙˙˙˙˙ or if (i==3) {puts("Three");}
˙˙˙˙˙˙˙˙ else˙˙˙˙˙˙˙˙ {puts("Other");}
[...]case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
default˙ // 1 5 7 11 13
[...]˙˙˙ if (0)
˙˙˙ else if (x%2==0) {}
˙˙˙ else if (x%3==0) {}
˙ if (x%2==0) {}
˙ if (x%3==0) {}
Here it is clear they are non-exclusive.
You're also in luck: this is exactly how C works now!
On 2026-10-26 17:42, bartc wrote:
On 26/10/2026 16:37, fir wrote:[...]
bartc pisze:
On 26/10/2026 16:03, fir wrote:
bartc pisze:
On 26/10/2026 12:20, fir wrote:
bartc pisze:
On 26/10/2026 12:07, fir wrote:
fir pisze:
if {} or if {} or if {} else {}
[...]if () {}
or if () {}
or if() {}
else {}
[...]˙˙˙˙ #define or else
˙˙˙˙ for (int i=0; i<=5; ++i)
˙˙˙˙˙˙˙˙ if˙˙˙ (i==1) {puts("One");}
˙˙˙˙˙˙˙˙ or if (i==2) {puts("Two");}
˙˙˙˙˙˙˙˙ or if (i==3) {puts("Three");}
˙˙˙˙˙˙˙˙ else˙˙˙˙˙˙˙˙ {puts("Other");}
[...]case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
default˙ // 1 5 7 11 13
[...]˙˙˙ if (0)
˙˙˙ else if (x%2==0) {}
˙˙˙ else if (x%3==0) {}
˙˙ if (x%2==0) {}
˙˙ if (x%3==0) {}
Here it is clear they are non-exclusive.
You're also in luck: this is exactly how C works now!
I'm not sure what fir actually wants; I cannot decipher his writings
quoted by you. But, given that he not yet seems satisfied with your
replies and suggestions, could it, by any chance, be that what he
wants is some non-deterministic construct like Dijkstra's Guards?
I.e., that with two guards 'x%2==0' and 'x%3==0' and an input of "6"
only _one_ of the two gets _arbitrarily_ triggered?
(Otherwise his post appears quite pointless to me.)
Janis
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 wrongYou seem fixated on that 'or'. Either use 'else', or create 'or' as
you cant
an alias as I suggested.
imo you should try to understand the example
for(int i = 1; i < 20; i++)
{
˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n divides by 2");
˙˙˙˙˙ or if(x%3==0) printf("\n divides by 3");
˙˙˙˙˙ else˙ printf("\n no divides (by 2 or 3)");
}
you understand how this would work? i think you do
and how in normal c without this "or" it would look,
for exampel in your if else model?
Show me exactly what the output should be, when it is written like this:
˙˙˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n%d divides by 2", i);
˙˙˙˙˙˙˙ or if(x%3==0) printf("\n%d divides by 3", i);
˙˙˙˙˙˙˙ else˙ printf("\n%d no divides (by 2 or 3)", i);
You might also want to look at the FizzBuzz program.
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)
On 26/10/2026 17:06, 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.
imo you should try to understand the example
for(int i = 1; i < 20; i++)
{
˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n divides by 2");
˙˙˙˙˙ or if(x%3==0) printf("\n divides by 3");
˙˙˙˙˙ else˙ printf("\n no divides (by 2 or 3)");
}
you understand how this would work? i think you do
and how in normal c without this "or" it would look,
for exampel in your if else model?
Show me exactly what the output should be, when it is written like this: >>>
˙˙˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n%d divides by 2", i);
˙˙˙˙˙˙˙ or if(x%3==0) printf("\n%d divides by 3", i);
˙˙˙˙˙˙˙ else˙ printf("\n%d no divides (by 2 or 3)", i);
You might also want to look at the FizzBuzz program.
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)
OK, thanks. So the pattern you're talking about is this:
˙ case (c1) {s1}
˙ case (c2) {s2}
˙ case (c3) {s3}
˙ else˙˙˙˙˙ {s4}
where each of s1/s2/s3 is executed if the corresponding c1/c2/c3 is
true, independently of the others. At least one statement will be
executed in 7 of the 8 possible boolean combinations in this example.
s4 is only executed when each of c1/c2/c3 is false. In other words:
˙ if (c1) {s1}
˙ if (c2) {s2}
˙ if (c3) {s3}
˙ if (!c1 && !c2 && !c3) {s4}
Assuming c1/c2/c3 are not modified by s1/s2/s3, but this is also partly
the case with your proposal.
Or maybe it can be done like this:
˙ if (c1 || c2 || c3) {
˙˙˙˙˙ s4
˙ else if (c1) {s1)
˙ ....
The syntax will anyway need some work to tie all those case/if parts together (as s2 for example could contain nested versions).
Or you can forget about having to create a hard-to-grasp and awkward-to-implement feature like this, and either use workarounds like
my C examples, or use another approach to the problem.
bartc pisze:
hahaha1 no divides (by 2 or 3)
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)
OK, thanks. So the pattern you're talking about is this:
˙˙ case (c1) {s1}
˙˙ case (c2) {s2}
˙˙ case (c3) {s3}
˙˙ else˙˙˙˙˙ {s4}
where each of s1/s2/s3 is executed if the corresponding c1/c2/c3 is
true, independently of the others. At least one statement will be
executed in 7 of the 8 possible boolean combinations in this example.
s4 is only executed when each of c1/c2/c3 is false. In other words:
˙˙ if (c1) {s1}
˙˙ if (c2) {s2}
˙˙ if (c3) {s3}
˙˙ if (!c1 && !c2 && !c3) {s4}
Assuming c1/c2/c3 are not modified by s1/s2/s3, but this is also
partly the case with your proposal.
Or maybe it can be done like this:
˙˙ if (c1 || c2 || c3) {
˙˙˙˙˙˙ s4
˙˙ else if (c1) {s1)
˙˙ ....
The syntax will anyway need some work to tie all those case/if parts
together (as s2 for example could contain nested versions).
Or you can forget about having to create a hard-to-grasp and awkward-
to-implement feature like this, and either use workarounds like my C
examples, or use another approach to the problem.
lol ye use worakarounds instead of simple right solution
(this solution may come in some plavours as i said before, but this or ketword for reasons mentioned is not bad)
On 26/10/2026 19:39, fir wrote:
bartc pisze:
hahaha1 no divides (by 2 or 3)
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)
OK, thanks. So the pattern you're talking about is this:
˙˙ case (c1) {s1}
˙˙ case (c2) {s2}
˙˙ case (c3) {s3}
˙˙ else˙˙˙˙˙ {s4}
where each of s1/s2/s3 is executed if the corresponding c1/c2/c3 is
true, independently of the others. At least one statement will be
executed in 7 of the 8 possible boolean combinations in this example.
s4 is only executed when each of c1/c2/c3 is false. In other words:
˙˙ if (c1) {s1}
˙˙ if (c2) {s2}
˙˙ if (c3) {s3}
˙˙ if (!c1 && !c2 && !c3) {s4}
Assuming c1/c2/c3 are not modified by s1/s2/s3, but this is also
partly the case with your proposal.
Or maybe it can be done like this:
˙˙ if (c1 || c2 || c3) {
˙˙˙˙˙˙ s4
˙˙ else if (c1) {s1)
˙˙ ....
The syntax will anyway need some work to tie all those case/if parts
together (as s2 for example could contain nested versions).
Or you can forget about having to create a hard-to-grasp and awkward-
to-implement feature like this, and either use workarounds like my C
examples, or use another approach to the problem.
lol ye use worakarounds instead of simple right solution
The right solution to what problem? It took multiple posts before you
even managed to explain how your proposal is supposed to behave.
(And then tomorrow it'll probably do something else.)
(this solution may come in some plavours as i said before, but this or
ketword for reasons mentioned is not bad)
OK, try a simple experiment: convert some code using your 'or' keyword
to regular C syntax and post it here. Preferably on a real example.
Because I've not convinced it comes up often enough to be worth a
dedicated feature.
Then, consider examples like this:
˙ case (a==b and c==d) {}
˙ case (a==b and e==f) {}
˙ case (a<b) {}
˙ case (a>=b) {}
˙ case (c==d) {}
You'll find, when converting to regular C, that detecting the case of
all false will mean checking all conditions, but now those will contain duplicates. It is hard to cleanly express, which is a bad sign as a prospective language feature.
On 26/10/2026 19:39, fir wrote:
bartc pisze:
hahaha1 no divides (by 2 or 3)
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)
OK, thanks. So the pattern you're talking about is this:
˙˙ case (c1) {s1}
˙˙ case (c2) {s2}
˙˙ case (c3) {s3}
˙˙ else˙˙˙˙˙ {s4}
where each of s1/s2/s3 is executed if the corresponding c1/c2/c3 is
true, independently of the others. At least one statement will be
executed in 7 of the 8 possible boolean combinations in this example.
s4 is only executed when each of c1/c2/c3 is false. In other words:
˙˙ if (c1) {s1}
˙˙ if (c2) {s2}
˙˙ if (c3) {s3}
˙˙ if (!c1 && !c2 && !c3) {s4}
Assuming c1/c2/c3 are not modified by s1/s2/s3, but this is also
partly the case with your proposal.
Or maybe it can be done like this:
˙˙ if (c1 || c2 || c3) {
˙˙˙˙˙˙ s4
˙˙ else if (c1) {s1)
˙˙ ....
The syntax will anyway need some work to tie all those case/if parts
together (as s2 for example could contain nested versions).
Or you can forget about having to create a hard-to-grasp and awkward-
to-implement feature like this, and either use workarounds like my C
examples, or use another approach to the problem.
lol ye use worakarounds instead of simple right solution
The right solution to what problem? It took multiple posts before you
even managed to explain how your proposal is supposed to behave.
(And then tomorrow it'll probably do something else.)
(this solution may come in some plavours as i said before, but this or
ketword for reasons mentioned is not bad)
OK, try a simple experiment: convert some code using your 'or' keyword
to regular C syntax and post it here. Preferably on a real example.
Because I've not convinced it comes up often enough to be worth a
dedicated feature.
Then, consider examples like this:
˙ case (a==b and c==d) {}
˙ case (a==b and e==f) {}
˙ case (a<b) {}
˙ case (a>=b) {}
˙ case (c==d) {}
You'll find, when converting to regular C, that detecting the case of
all false will mean checking all conditions, but now those will contain duplicates. It is hard to cleanly express, which is a bad sign as a prospective language feature.
bartc pisze:
On 26/10/2026 19:39, fir wrote:
bartc pisze:
hahaha1 no divides (by 2 or 3)
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)
OK, thanks. So the pattern you're talking about is this:
˙˙ case (c1) {s1}
˙˙ case (c2) {s2}
˙˙ case (c3) {s3}
˙˙ else˙˙˙˙˙ {s4}
where each of s1/s2/s3 is executed if the corresponding c1/c2/c3 is
true, independently of the others. At least one statement will be
executed in 7 of the 8 possible boolean combinations in this example.
s4 is only executed when each of c1/c2/c3 is false. In other words:
˙˙ if (c1) {s1}
˙˙ if (c2) {s2}
˙˙ if (c3) {s3}
˙˙ if (!c1 && !c2 && !c3) {s4}
Assuming c1/c2/c3 are not modified by s1/s2/s3, but this is also
partly the case with your proposal.
Or maybe it can be done like this:
˙˙ if (c1 || c2 || c3) {
˙˙˙˙˙˙ s4
˙˙ else if (c1) {s1)
˙˙ ....
The syntax will anyway need some work to tie all those case/if parts
together (as s2 for example could contain nested versions).
Or you can forget about having to create a hard-to-grasp and
awkward- to-implement feature like this, and either use workarounds
like my C examples, or use another approach to the problem.
lol ye use worakarounds instead of simple right solution
The right solution to what problem? It took multiple posts before you
even managed to explain how your proposal is supposed to behave.
(And then tomorrow it'll probably do something else.)
(this solution may come in some plavours as i said before, but this
or ketword for reasons mentioned is not bad)
OK, try a simple experiment: convert some code using your 'or' keyword
to regular C syntax and post it here. Preferably on a real example.
you cant properly convert this or/and groups to c in good way becouse
there is flaw in c you cannot express all needed combinations generally
with sole if 's and else's
as was showed here
Because I've not convinced it comes up often enough to be worth a
dedicated feature.
Then, consider examples like this:
˙˙ case (a==b and c==d) {}
˙˙ case (a==b and e==f) {}
˙˙ case (a<b) {}
˙˙ case (a>=b) {}
˙˙ case (c==d) {}
You'll find, when converting to regular C, that detecting the case of
all false will mean checking all conditions, but now those will
contain duplicates. It is hard to cleanly express, which is a bad sign
as a prospective language feature.
i dont like get what you talk here..overally this is a work for compiler
to simplify it in output
btw you think i should defend the things i was talking about -
i more see its a waste of time if someone dont understand things
it is for him if he understoods or not, i have not so much time to
defend obvious things against the people who not care to much to
understand things
i would sy like its taking hours repairing a code that is
good - whou would like to do it?
generally such time spanding that you got good code and some weird
people come nad put a bulshit its wrong and expect me to explain this is
not its not a good time spending imo
i would rather expect if some will find some 'bug ' in code then he
first should understand it
bartc pisze:
On 26/10/2026 19:39, fir wrote:
bartc pisze:
hahaha1 no divides (by 2 or 3)
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)
OK, thanks. So the pattern you're talking about is this:
˙˙ case (c1) {s1}
˙˙ case (c2) {s2}
˙˙ case (c3) {s3}
˙˙ else˙˙˙˙˙ {s4}
where each of s1/s2/s3 is executed if the corresponding c1/c2/c3 is
true, independently of the others. At least one statement will be
executed in 7 of the 8 possible boolean combinations in this example.
s4 is only executed when each of c1/c2/c3 is false. In other words:
˙˙ if (c1) {s1}
˙˙ if (c2) {s2}
˙˙ if (c3) {s3}
˙˙ if (!c1 && !c2 && !c3) {s4}
Assuming c1/c2/c3 are not modified by s1/s2/s3, but this is also
partly the case with your proposal.
Or maybe it can be done like this:
˙˙ if (c1 || c2 || c3) {
˙˙˙˙˙˙ s4
˙˙ else if (c1) {s1)
˙˙ ....
The syntax will anyway need some work to tie all those case/if parts
together (as s2 for example could contain nested versions).
Or you can forget about having to create a hard-to-grasp and
awkward- to-implement feature like this, and either use workarounds
like my C examples, or use another approach to the problem.
lol ye use worakarounds instead of simple right solution
The right solution to what problem? It took multiple posts before you
even managed to explain how your proposal is supposed to behave.
well i was surprised how slow you think it is the reason you get things
slow - and that s why it took multiple posts
and i make laugh becouse its funny how some slowly take some things and
how bad answer thay give - its kinda laughable
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or' keyword
to regular C syntax and post it here. Preferably on a real example.
you cant properly convert this or/and groups to c in good way becouse
there is flaw in c you cannot express all needed combinations generally
with sole if 's and else's
as was showed here
You'll find, when converting to regular C, that detecting the case of
all false will mean checking all conditions, but now those will
contain duplicates. It is hard to cleanly express, which is a bad sign
as a prospective language feature.
i dont like get what you talk here..overally this is a work for compiler
to simplify it in output
btw you think i should defend the things i was talking about -
i more see its a waste of time if someone dont understand things
it is for him if he understoods or not, i have not so much time to
defend obvious things against the people who not care to much to
understand things
i would sy like its taking hours repairing a code that is
good - whou would like to do it?
generally such time spanding that you got good code and some weird
people come nad put a bulshit its wrong and expect me to explain this is
not its not a good time spending imo
i would rather expect if some will find some 'bug ' in code then he
first should understand it
On 26/10/2026 20:32, fir wrote:
bartc pisze:
There are a couple of reasons to express it in C:OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a real
example.
you cant properly convert this or/and groups to c in good way becouse
there is flaw in c you cannot express all needed combinations
generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙ if (f1()) {}
˙ if (f2()) {}
˙ ...
˙ if (!f1() && !f2()) {}
Here f1/f2 are called twice. This means making internal copies or
setting flags.
You'll find, when converting to regular C, that detecting the case of
all false will mean checking all conditions, but now those will
contain duplicates. It is hard to cleanly express, which is a bad
sign as a prospective language feature.
i dont like get what you talk here..overally this is a work for compiler
to simplify it in output
In my case the compiler is my job too!
btw you think i should defend the things i was talking about -
i more see its a waste of time if someone dont understand things
it is for him if he understoods or not, i have not so much time to
defend obvious things against the people who not care to much to
understand things
i would sy like its taking hours repairing a code that is
good - whou would like to do it?
generally such time spanding that you got good code and some weird
people come nad put a bulshit its wrong and expect me to explain this
is not its not a good time spending imo
i would rather expect if some will find some 'bug ' in code then he
first should understand it
Why bother posting in a public forum if you don't care about people understand what you're on about? Do you not want people to engage?
Then post to alt.test instead.
On 26/10/2026 20:13, fir wrote:
bartc pisze:
On 26/10/2026 19:39, fir wrote:
bartc pisze:
hahaha1 no divides (by 2 or 3)
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)
OK, thanks. So the pattern you're talking about is this:
˙˙ case (c1) {s1}
˙˙ case (c2) {s2}
˙˙ case (c3) {s3}
˙˙ else˙˙˙˙˙ {s4}
where each of s1/s2/s3 is executed if the corresponding c1/c2/c3 is >>>>> true, independently of the others. At least one statement will be
executed in 7 of the 8 possible boolean combinations in this example. >>>>>
s4 is only executed when each of c1/c2/c3 is false. In other words:
˙˙ if (c1) {s1}
˙˙ if (c2) {s2}
˙˙ if (c3) {s3}
˙˙ if (!c1 && !c2 && !c3) {s4}
Assuming c1/c2/c3 are not modified by s1/s2/s3, but this is also
partly the case with your proposal.
Or maybe it can be done like this:
˙˙ if (c1 || c2 || c3) {
˙˙˙˙˙˙ s4
˙˙ else if (c1) {s1)
˙˙ ....
The syntax will anyway need some work to tie all those case/if
parts together (as s2 for example could contain nested versions).
Or you can forget about having to create a hard-to-grasp and
awkward- to-implement feature like this, and either use workarounds >>>>> like my C examples, or use another approach to the problem.
lol ye use worakarounds instead of simple right solution
The right solution to what problem? It took multiple posts before you
even managed to explain how your proposal is supposed to behave.
well i was surprised how slow you think it is the reason you get
things slow - and that s why it took multiple posts
Mainly from you failing to explain? You wrote comments like this:
"this wouldnt work imo as far as im aware becouse this last else dont
work on "group'"
IMO? It either works or it doesn't, and if not, explain why 'or' was not just an alias for 'else'.
and i make laugh becouse its funny how some slowly take some things
and how bad answer thay give - its kinda laughable
Well, this is the thing: given a well-specified, well-thought-out
feature, I can probably implement it in one of my compilers within a day.
That can serve as a proof-of-concept, and can be used to see how well it stands up and how useful it actually is.
This one wouldn't pass that bar. But also, I've not convinced that you
put much thought into it. If I implemented it, you'd change your mind
about it, or add new twists, or get bored and think up something else.
It would be a waste of time.
So what's the purpose of these hundreds of wacky, random ideas: do you expect someone else to implement them for you? If so, in which language?
Today was a bit of fun, but I can't take your ideas seriously.
Today was a bit of fun, but I can't take your ideas seriously.
On 26/10/2026 20:32, fir wrote:
bartc pisze:
There are a couple of reasons to express it in C:OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a real
example.
you cant properly convert this or/and groups to c in good way becouse
there is flaw in c you cannot express all needed combinations
generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙ if (f1()) {}
˙ if (f2()) {}
˙ ...
˙ if (!f1() && !f2()) {}Also, if f1 succeeds, then f2 might not have to be called at all because
Here f1/f2 are called twice. This means making internal copies or
setting flags.
bartc pisze:
Today was a bit of fun, but I can't take your ideas seriously.
definitely was not it was boring and a time waste ..i could do much
btter things
escept maybe cooking this example with if {} or if {}˙ else {}
this example is good as its small and shows the lacks of ifs and elses
logic in c (so its quite otable example)
but besides that it was timewaste
On 10/26/2026 2:11 PM, bartc wrote:
On 26/10/2026 20:32, fir wrote:
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a real
example.
you cant properly convert this or/and groups to c in good way becouse
there is flaw in c you cannot express all needed combinations
generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙˙ if (f1()) {}
˙˙ if (f2()) {}
˙˙ ...
˙˙ if (!f1() && !f2()) {}
Here f1/f2 are called twice. This means making internal copies or
setting flags.
So you call f1 and f2, then call if (!f1() && !f2()) {}. So, that is
your choice. Not the fault of C, right?
On 26/10/2026 20:13, fir wrote:
bartc pisze:
On 26/10/2026 19:39, fir wrote:
bartc pisze:
hahaha1 no divides (by 2 or 3)
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)
OK, thanks. So the pattern you're talking about is this:
˙˙ case (c1) {s1}
˙˙ case (c2) {s2}
˙˙ case (c3) {s3}
˙˙ else˙˙˙˙˙ {s4}
where each of s1/s2/s3 is executed if the corresponding c1/c2/c3 is >>>>> true, independently of the others. At least one statement will be
executed in 7 of the 8 possible boolean combinations in this example. >>>>>
s4 is only executed when each of c1/c2/c3 is false. In other words:
˙˙ if (c1) {s1}
˙˙ if (c2) {s2}
˙˙ if (c3) {s3}
˙˙ if (!c1 && !c2 && !c3) {s4}
Assuming c1/c2/c3 are not modified by s1/s2/s3, but this is also
partly the case with your proposal.
Or maybe it can be done like this:
˙˙ if (c1 || c2 || c3) {
˙˙˙˙˙˙ s4
˙˙ else if (c1) {s1)
˙˙ ....
The syntax will anyway need some work to tie all those case/if
parts together (as s2 for example could contain nested versions).
Or you can forget about having to create a hard-to-grasp and
awkward- to-implement feature like this, and either use workarounds >>>>> like my C examples, or use another approach to the problem.
lol ye use worakarounds instead of simple right solution
The right solution to what problem? It took multiple posts before you
even managed to explain how your proposal is supposed to behave.
well i was surprised how slow you think it is the reason you get
things slow - and that s why it took multiple posts
Mainly from you failing to explain? You wrote comments like this:
"this wouldnt work imo as far as im aware becouse this last else dont
work on "group'"
IMO? It either works or it doesn't, and if not, explain why 'or' was not just an alias for 'else'.
and i make laugh becouse its funny how some slowly take some things
and how bad answer thay give - its kinda laughable
Well, this is the thing: given a well-specified, well-thought-out
feature, I can probably implement it in one of my compilers within a day.
That can serve as a proof-of-concept, and can be used to see how well it stands up and how useful it actually is.
This one wouldn't pass that bar. But also, I've not convinced that you
put much thought into it. If I implemented it, you'd change your mind
about it, or add new twists, or get bored and think up something else.
It would be a waste of time.
So what's the purpose of these hundreds of wacky, random ideas: do you expect someone else to implement them for you? If so, in which language?
Today was a bit of fun, but I can't take your ideas seriously.
On 10/26/2026 2:11 PM, bartc wrote:
On 26/10/2026 20:32, fir wrote:
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a real
example.
you cant properly convert this or/and groups to c in good way becouse
there is flaw in c you cannot express all needed combinations
generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙˙ if (f1()) {}
˙˙ if (f2()) {}
˙˙ ...
No, the 'if f2(){}' line must be executed whether f1() was true or also.˙˙ if (!f1() && !f2()) {}Also, if f1 succeeds, then f2 might not have to be called at all because
Here f1/f2 are called twice. This means making internal copies or
setting flags.
it already broke the contract?
On 26/10/2026 21:43, Chris M. Thomasson wrote:
On 10/26/2026 2:11 PM, bartc wrote:No, the 'if f2(){}' line must be executed whether f1() was true or also.
On 26/10/2026 20:32, fir wrote:
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a real
example.
you cant properly convert this or/and groups to c in good way
becouse there is flaw in c you cannot express all needed
combinations generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙˙ if (f1()) {}
˙˙ if (f2()) {}
˙˙ ...
˙˙ if (!f1() && !f2()) {}Also, if f1 succeeds, then f2 might not have to be called at all
Here f1/f2 are called twice. This means making internal copies or
setting flags.
because it already broke the contract?
As I understand the feature: they are independent conditional blocks.
But the final else{} must be executed if all were false.
I think if you have to explain it, then it's a bad sign!
On 26/10/2026 21:17, Chris M. Thomasson wrote:
On 10/26/2026 2:11 PM, bartc wrote:
On 26/10/2026 20:32, fir wrote:
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a real
example.
you cant properly convert this or/and groups to c in good way
becouse there is flaw in c you cannot express all needed
combinations generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙˙ if (f1()) {}
˙˙ if (f2()) {}
˙˙ ...
˙˙ if (!f1() && !f2()) {}
Here f1/f2 are called twice. This means making internal copies or
setting flags.
So you call f1 and f2, then call if (!f1() && !f2()) {}. So, that is
your choice. Not the fault of C, right?
It's not the fault of C. But the C illustrates the logic of this new feature: it must only call the 'else' clause when none of the conditions
are true.
But if the most direct way of expressing it has this issue, then extra workarounds are needed, for example:
˙˙ flag=1;
˙˙ if f1() {flag=0;...)
˙˙ if f2() {flag=0;...)
˙˙ if (flag) {}
(Note the logic here is slightly different: the else block is executed
when none of the previous blocks have been entered. Because conditionals
may have different values at this point. But we don't know the proper
spec.)
This actually isn't too bad, but in that case, why do we even need this
new feature?
My main problem with it is that it is unintuitive and that its use-cases
are limited. It's also likely to morph into something else when fir gets bored with it.
On 26/10/2026 22:50, bartc wrote:
On 26/10/2026 21:17, Chris M. Thomasson wrote:
On 10/26/2026 2:11 PM, bartc wrote:
On 26/10/2026 20:32, fir wrote:
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a real >>>>>> example.
you cant properly convert this or/and groups to c in good way
becouse there is flaw in c you cannot express all needed
combinations generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙˙ if (f1()) {}
˙˙ if (f2()) {}
˙˙ ...
˙˙ if (!f1() && !f2()) {}
Here f1/f2 are called twice. This means making internal copies or
setting flags.
So you call f1 and f2, then call if (!f1() && !f2()) {}. So, that is
your choice. Not the fault of C, right?
It's not the fault of C. But the C illustrates the logic of this new
feature: it must only call the 'else' clause when none of the
conditions are true.
But if the most direct way of expressing it has this issue, then extra
workarounds are needed, for example:
˙˙˙ flag=1;
˙˙˙ if f1() {flag=0;...)
˙˙˙ if f2() {flag=0;...)
˙˙˙ if (flag) {}
(Note the logic here is slightly different: the else block is executed
when none of the previous blocks have been entered. Because
conditionals may have different values at this point. But we don't
know the proper spec.)
This actually isn't too bad, but in that case, why do we even need
this new feature?
My main problem with it is that it is unintuitive and that its
use-cases are limited. It's also likely to morph into something else
when fir gets bored with it.
#define fir_switch _Bool flag = 1; {
#define or_if(...) } if (__VA_ARGS__) { flag = 0;
#define otherwise } if (!flag)
Then Fir can write :
˙˙˙˙fir_switch
˙˙˙˙or_if (x % 2 == 0) printf("\n divides by 2");
˙˙˙˙or_if (x % 3 == 0) printf("\n divides by 3");
˙˙˙˙otherwise printf("\n does not divide by 2 or 3");
I haven't tested the defines, and I think it is a terrible idea (it
should at least be called "and_if"), but it comes very close to the
syntax and semantics Fir appears to want.
David Brown pisze:
On 26/10/2026 22:50, bartc wrote:
On 26/10/2026 21:17, Chris M. Thomasson wrote:
On 10/26/2026 2:11 PM, bartc wrote:
On 26/10/2026 20:32, fir wrote:
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a
real example.
you cant properly convert this or/and groups to c in good way
becouse there is flaw in c you cannot express all needed
combinations generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙˙ if (f1()) {}
˙˙ if (f2()) {}
˙˙ ...
˙˙ if (!f1() && !f2()) {}
Here f1/f2 are called twice. This means making internal copies or
setting flags.
So you call f1 and f2, then call if (!f1() && !f2()) {}. So, that is
your choice. Not the fault of C, right?
It's not the fault of C. But the C illustrates the logic of this new
feature: it must only call the 'else' clause when none of the
conditions are true.
But if the most direct way of expressing it has this issue, then
extra workarounds are needed, for example:
˙˙˙ flag=1;
˙˙˙ if f1() {flag=0;...)
˙˙˙ if f2() {flag=0;...)
˙˙˙ if (flag) {}
(Note the logic here is slightly different: the else block is
executed when none of the previous blocks have been entered. Because
conditionals may have different values at this point. But we don't
know the proper spec.)
This actually isn't too bad, but in that case, why do we even need
this new feature?
My main problem with it is that it is unintuitive and that its
use-cases are limited. It's also likely to morph into something else
when fir gets bored with it.
#define fir_switch _Bool flag = 1; {
#define or_if(...) } if (__VA_ARGS__) { flag = 0;
#define otherwise } if (!flag)
Then Fir can write :
˙˙˙˙˙fir_switch
˙˙˙˙˙or_if (x % 2 == 0) printf("\n divides by 2");
˙˙˙˙˙or_if (x % 3 == 0) printf("\n divides by 3");
˙˙˙˙˙otherwise printf("\n does not divide by 2 or 3");
I haven't tested the defines, and I think it is a terrible idea (it
should at least be called "and_if"), but it comes very close to the
syntax and semantics Fir appears to want.
totally no, its not also i want this i just makec conclusion if-else
system is flawed
you may ment it on some ways lik
if {}
or
if {}
else {}
or
case {}
case {}
otherwise {}
in first case you got heneral system of logic operators applied to group
of ifs (coz you may use not olny or but also and or not etc),
˙in second you got like predefined keywords for "or or or" case
(here in fact otherwise keyword means use or for cases and of 0
evaluate otherwise)
i thing you will nned a general but predefined may be also handy so eventually language could implement both (such as it has many forms for loops to increase intentions readability)
flag is a nonsense its liek implementing else with flag
int not = 1;
if (a>2) {not =0; //...}
if(not) {}
;C
NOTE btw this case not only shows flaw in if rlse system but is just
natural fom of switch (both of them i mean "if or if else" and "case
case otherwise"..and imo thsi form is better than switch as its more
natural its grounded -its also shows lacks of switch so it shows both
if-else system is flawed and switch is flawed too
David Brown pisze:
On 26/10/2026 22:50, bartc wrote:
On 26/10/2026 21:17, Chris M. Thomasson wrote:
On 10/26/2026 2:11 PM, bartc wrote:
On 26/10/2026 20:32, fir wrote:
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a
real example.
you cant properly convert this or/and groups to c in good way
becouse there is flaw in c you cannot express all needed
combinations generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙˙ if (f1()) {}
˙˙ if (f2()) {}
˙˙ ...
˙˙ if (!f1() && !f2()) {}
Here f1/f2 are called twice. This means making internal copies or
setting flags.
So you call f1 and f2, then call if (!f1() && !f2()) {}. So, that is
your choice. Not the fault of C, right?
It's not the fault of C. But the C illustrates the logic of this new
feature: it must only call the 'else' clause when none of the
conditions are true.
But if the most direct way of expressing it has this issue, then
extra workarounds are needed, for example:
˙˙˙ flag=1;
˙˙˙ if f1() {flag=0;...)
˙˙˙ if f2() {flag=0;...)
˙˙˙ if (flag) {}
(Note the logic here is slightly different: the else block is
executed when none of the previous blocks have been entered. Because
conditionals may have different values at this point. But we don't
know the proper spec.)
This actually isn't too bad, but in that case, why do we even need
this new feature?
My main problem with it is that it is unintuitive and that its
use-cases are limited. It's also likely to morph into something else
when fir gets bored with it.
#define fir_switch _Bool flag = 1; {
#define or_if(...) } if (__VA_ARGS__) { flag = 0;
#define otherwise } if (!flag)
Then Fir can write :
˙˙˙˙˙fir_switch
˙˙˙˙˙or_if (x % 2 == 0) printf("\n divides by 2");
˙˙˙˙˙or_if (x % 3 == 0) printf("\n divides by 3");
˙˙˙˙˙otherwise printf("\n does not divide by 2 or 3");
I haven't tested the defines, and I think it is a terrible idea (it
should at least be called "and_if"), but it comes very close to the
syntax and semantics Fir appears to want.
totally no, its not also i want this i just makec conclusion if-else
system is flawed
you may ment it on some ways lik
if {}
or
if {}
else {}
or
case {}
case {}
otherwise {}
in first case you got heneral system of logic operators applied to group
of ifs (coz you may use not olny or but also and or not etc),
˙in second you got like predefined keywords for "or or or" case
(here in fact otherwise keyword means use or for cases and of 0
evaluate otherwise)
i thing you will nned a general but predefined may be also handy so eventually language could implement both (such as it has many forms for loops to increase intentions readability)
flag is a nonsense its liek implementing else with flag
int not = 1;
if (a>2) {not =0; //...}
if(not) {}
;C
NOTE btw this case not only shows flaw in if rlse system but is just
natural fom of switch (both of them i mean "if or if else" and "case
case otherwise"..and imo thsi form is better than switch as its more
natural its grounded -its also shows lacks of switch so it shows both
if-else system is flawed and switch is flawed too
On 26/10/2026 22:50, bartc wrote:It looks pretty good and it seems to work (the !flag needs the reverse
On 26/10/2026 21:17, Chris M. Thomasson wrote:
On 10/26/2026 2:11 PM, bartc wrote:
On 26/10/2026 20:32, fir wrote:
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a real >>>>>> example.
you cant properly convert this or/and groups to c in good way
becouse there is flaw in c you cannot express all needed
combinations generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙˙ if (f1()) {}
˙˙ if (f2()) {}
˙˙ ...
˙˙ if (!f1() && !f2()) {}
Here f1/f2 are called twice. This means making internal copies or
setting flags.
So you call f1 and f2, then call if (!f1() && !f2()) {}. So, that is
your choice. Not the fault of C, right?
It's not the fault of C. But the C illustrates the logic of this new
feature: it must only call the 'else' clause when none of the
conditions are true.
But if the most direct way of expressing it has this issue, then extra
workarounds are needed, for example:
˙˙˙ flag=1;
˙˙˙ if f1() {flag=0;...)
˙˙˙ if f2() {flag=0;...)
˙˙˙ if (flag) {}
(Note the logic here is slightly different: the else block is executed
when none of the previous blocks have been entered. Because
conditionals may have different values at this point. But we don't
know the proper spec.)
This actually isn't too bad, but in that case, why do we even need
this new feature?
My main problem with it is that it is unintuitive and that its use-
cases are limited. It's also likely to morph into something else when
fir gets bored with it.
#define fir_switch _Bool flag = 1; {
#define or_if(...) } if (__VA_ARGS__) { flag = 0;
#define otherwise } if (!flag)
Then Fir can write :
˙˙˙˙fir_switch
˙˙˙˙or_if (x % 2 == 0) printf("\n divides by 2");
˙˙˙˙or_if (x % 3 == 0) printf("\n divides by 3");
˙˙˙˙otherwise printf("\n does not divide by 2 or 3");
I haven't tested the defines, and I think it is a terrible idea (it
should at least be called "and_if"), but it comes very close to the
syntax and semantics Fir appears to want.
On 26/10/2026 22:37, David Brown wrote:
On 26/10/2026 22:50, bartc wrote:It looks pretty good and it seems to work (the !flag needs the reverse logic). The 'and_if' makes more sense too.
On 26/10/2026 21:17, Chris M. Thomasson wrote:
On 10/26/2026 2:11 PM, bartc wrote:
On 26/10/2026 20:32, fir wrote:
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a
real example.
you cant properly convert this or/and groups to c in good way
becouse there is flaw in c you cannot express all needed
combinations generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙˙ if (f1()) {}
˙˙ if (f2()) {}
˙˙ ...
˙˙ if (!f1() && !f2()) {}
Here f1/f2 are called twice. This means making internal copies or
setting flags.
So you call f1 and f2, then call if (!f1() && !f2()) {}. So, that is
your choice. Not the fault of C, right?
It's not the fault of C. But the C illustrates the logic of this new
feature: it must only call the 'else' clause when none of the
conditions are true.
But if the most direct way of expressing it has this issue, then
extra workarounds are needed, for example:
˙˙˙ flag=1;
˙˙˙ if f1() {flag=0;...)
˙˙˙ if f2() {flag=0;...)
˙˙˙ if (flag) {}
(Note the logic here is slightly different: the else block is
executed when none of the previous blocks have been entered. Because
conditionals may have different values at this point. But we don't
know the proper spec.)
This actually isn't too bad, but in that case, why do we even need
this new feature?
My main problem with it is that it is unintuitive and that its use-
cases are limited. It's also likely to morph into something else when
fir gets bored with it.
#define fir_switch _Bool flag = 1; {
#define or_if(...) } if (__VA_ARGS__) { flag = 0;
#define otherwise } if (!flag)
Then Fir can write :
˙˙˙˙˙fir_switch
˙˙˙˙˙or_if (x % 2 == 0) printf("\n divides by 2");
˙˙˙˙˙or_if (x % 3 == 0) printf("\n divides by 3");
˙˙˙˙˙otherwise printf("\n does not divide by 2 or 3");
I haven't tested the defines, and I think it is a terrible idea (it
should at least be called "and_if"), but it comes very close to the
syntax and semantics Fir appears to want.
But of course it's not good enough for fir; there's always something.
On 10/5/2026 4:11 PM, bart wrote:
On 05/10/2026 22:48, Kaz Kylheku wrote:
On 2026-10-05, bart <bc@freeuk.com> wrote:
A lot of what big compilers do is what used to be called 'linting'.
I don't suspect you can get rid of that in any language.
The reason is that as experience with the given language grows, it is
found that programmers make certain mistakes, where making formal
syntactic and semantic rules against those mistakes, and sticking
them into the language, would be a poor idea.
At some point, you are trying to design a pencil that cannot be
used to draw an optical illusion.
I don't consider that to be their job, which should be to verify my
program and turn it into runnable code, and not give opinions.
That's a waste of potential; why would you refuse a machine that
can apply hundreds of deterministic pattern matching rules against
possible trouble situations in hundreds of thousands of lines of code,
in seconds.
I simply don't care about it. I don't have seconds to waste either.
Why not?
[...]
On 07/10/2026 22:06, Chris M. Thomasson wrote:
On 10/7/2026 5:52 AM, bart wrote:
On 07/10/2026 01:42, Kaz Kylheku wrote:
On 2026-10-05, bart <bc@freeuk.com> wrote:
On 05/10/2026 22:48, Kaz Kylheku wrote:
On 2026-10-05, bart <bc@freeuk.com> wrote:
A lot of what big compilers do is what used to be called 'linting'. >>>>>>I don't suspect you can get rid of that in any language.
The reason is that as experience with the given language grows, it is >>>>>> found that programmers make certain mistakes, where making formal
syntactic and semantic rules against those mistakes, and sticking
them into the language, would be a poor idea.
At some point, you are trying to design a pencil that cannot be
used to draw an optical illusion.
I don't consider that to be their job, which should be to verify my >>>>>>> program and turn it into runnable code, and not give opinions.
That's a waste of potential; why would you refuse a machine that
can apply hundreds of deterministic pattern matching rules against >>>>>> possible trouble situations in hundreds of thousands of lines of
code,
in seconds.
I simply don't care about it. I don't have seconds to waste either.
Your implementation of the same thing would take milliseconds, of
course.
I wouldn't want it at all.
But if I had to implement it, I don't know how long it would take. If
I found that it was taking disproportionately long (compared to the
main task of generating a binary), then I would separate it out from
the compiler, as I've suggested.
For example, if 90% of compile-time was spent on it.
Here are some common C-compiling scenarios:
* You want to build a finished, working, debugged program from source. >>>>> ˙˙˙ This does need the compiler spending time double-guessing the
author's
˙˙˙ intentions, and in any case the person building it is not going to >>>>> ˙˙˙ mess with the source
* You are building a program which is machine-transpiled C code. It
˙˙˙ should be valid C with no errors. (If there are, that is the
˙˙˙ responsibility of the transpiler author.) But again you don't care >>>>> ˙˙˙ about style, or the fact that there are lots of unused labels for >>>>> ˙˙˙ example (common in such code)
Then
* you still want linting in the source language.
Possibly. I don't care too much about that either. In my stuff, I do
very little in the way of advisory reports, which are only enabled
infrequently.
But the context here is using linting to warn about things that are a
consequence of C's design, such as switch 'break' that is the subject
of the thread.
I prefer to deal with that with a better language design.
Are you making a "new" C?[...]
I'm not making anything.
I have long maintained a personal systems language which fixes most of
my moans about C (and even deals with some of fir's needs, but those
seem to change erratically).
It would have been good for /someone else/ to have evolved C in a
direction I'd have found useful, but current evolvement of C is not interesting to me and IMO misguided.
Since I have my own solutions for the little coding I do now, this
doesn't matter so much - let C aficionados be masochists if they want.
But I am still interested in tooling (which has its own masochists!).
On 07/10/2026 01:45, Lawrence D?Oliveiro wrote:
On Tue, 6 Oct 2026 16:08:25 -0700, Chris M. Thomasson wrote:
On 10/6/2026 3:41 AM, David Brown wrote:
Anyone who sometimes makes mistakes should enable warnings.˙ And
that means /everyone/ should enable copious warnings.
Coin that!
Then there is ?confirmation fatigue?, where you get too inured to
ignoring spurious warnings, and miss the important one(s) in among the
noise.
Enabling lots of warning options does not mean triggering lots of warnings!
I don?t think there is any idiot-proof way to avoid being an idiot ...
On 26/10/2026 22:37, David Brown wrote:
On 26/10/2026 22:50, bartc wrote:It looks pretty good and it seems to work (the !flag needs the reverse logic). The 'and_if' makes more sense too.
On 26/10/2026 21:17, Chris M. Thomasson wrote:
On 10/26/2026 2:11 PM, bartc wrote:
On 26/10/2026 20:32, fir wrote:
bartc pisze:There are a couple of reasons to express it in C:
OK, try a simple experiment: convert some code using your 'or'
keyword to regular C syntax and post it here. Preferably on a
real example.
you cant properly convert this or/and groups to c in good way
becouse there is flaw in c you cannot express all needed
combinations generally with sole if 's and else's
as was showed here
* To illustrate exactly how you want the semantics to work, via
˙˙ an existing language whose behaviour is well known
* To highlight the problem areas
For example:
˙˙ if (f1()) {}
˙˙ if (f2()) {}
˙˙ ...
˙˙ if (!f1() && !f2()) {}
Here f1/f2 are called twice. This means making internal copies or
setting flags.
So you call f1 and f2, then call if (!f1() && !f2()) {}. So, that is
your choice. Not the fault of C, right?
It's not the fault of C. But the C illustrates the logic of this new
feature: it must only call the 'else' clause when none of the
conditions are true.
But if the most direct way of expressing it has this issue, then
extra workarounds are needed, for example:
˙˙˙ flag=1;
˙˙˙ if f1() {flag=0;...)
˙˙˙ if f2() {flag=0;...)
˙˙˙ if (flag) {}
(Note the logic here is slightly different: the else block is
executed when none of the previous blocks have been entered. Because
conditionals may have different values at this point. But we don't
know the proper spec.)
This actually isn't too bad, but in that case, why do we even need
this new feature?
My main problem with it is that it is unintuitive and that its use-
cases are limited. It's also likely to morph into something else when
fir gets bored with it.
#define fir_switch _Bool flag = 1; {
#define or_if(...) } if (__VA_ARGS__) { flag = 0;
#define otherwise } if (!flag)
Then Fir can write :
˙˙˙˙˙fir_switch
˙˙˙˙˙or_if (x % 2 == 0) printf("\n divides by 2");
˙˙˙˙˙or_if (x % 3 == 0) printf("\n divides by 3");
˙˙˙˙˙otherwise printf("\n does not divide by 2 or 3");
I haven't tested the defines, and I think it is a terrible idea (it
should at least be called "and_if"), but it comes very close to the
syntax and semantics Fir appears to want.
But of course it's not good enough for fir; there's always something.
if(x>0) printf("right"); and if(x<w) printf("left"); else printf(" outside");
On 10/26/2026 2:40 PM, fir wrote:
bartc pisze:
Today was a bit of fun, but I can't take your ideas seriously.
definitely was not it was boring and a time waste ..i could do much
btter things
escept maybe cooking this example with if {} or if {}˙ else {}
this example is good as its small and shows the lacks of ifs and elses
logic in c (so its quite otable example)
but besides that it was timewaste
Why are you wasting your time here on comp.lang.c?
bartc pisze:
On 26/10/2026 22:37, David Brown wrote:
#define fir_switch _Bool flag = 1; {It looks pretty good and it seems to work (the !flag needs the reverse
#define or_if(...) } if (__VA_ARGS__) { flag = 0;
#define otherwise } if (!flag)
Then Fir can write :
˙˙˙˙˙fir_switch
˙˙˙˙˙or_if (x % 2 == 0) printf("\n divides by 2");
˙˙˙˙˙or_if (x % 3 == 0) printf("\n divides by 3");
˙˙˙˙˙otherwise printf("\n does not divide by 2 or 3");
I haven't tested the defines, and I think it is a terrible idea (it
should at least be called "and_if"), but it comes very close to the
syntax and semantics Fir appears to want.
logic). The 'and_if' makes more sense too.
But of course it's not good enough for fir; there's always something.
blame the scienco fo doing just like tat
(one solution is a solution untill you find better one) ..im just doing science here so its science to blame, i got no problem with that
On 27/10/2026 08:37, fir wrote:
bartc pisze:
On 26/10/2026 22:37, David Brown wrote:
#define fir_switch _Bool flag = 1; {It looks pretty good and it seems to work (the !flag needs the
#define or_if(...) } if (__VA_ARGS__) { flag = 0;
#define otherwise } if (!flag)
Then Fir can write :
˙˙˙˙˙fir_switch
˙˙˙˙˙or_if (x % 2 == 0) printf("\n divides by 2");
˙˙˙˙˙or_if (x % 3 == 0) printf("\n divides by 3");
˙˙˙˙˙otherwise printf("\n does not divide by 2 or 3");
I haven't tested the defines, and I think it is a terrible idea (it
should at least be called "and_if"), but it comes very close to the
syntax and semantics Fir appears to want.
reverse logic). The 'and_if' makes more sense too.
But of course it's not good enough for fir; there's always something.
blame the scienco fo doing just like tat
(one solution is a solution untill you find better one) ..im just
doing science here so its science to blame, i got no problem with that
I've no idea what you mean. And I've no idea what it is you're actually after. I doubt anyone has. I doubt /you/ do!
You suggest some new statement type, in a C language forum, somebody
shows how to implement it in standard C, but your response is:
˙ "blame the scienco fo doing just like tat"
Not:
˙"Wow, thanks! That's perfect."
My guess is that you're not interested in actual solutions. You're just thinking up one random idea after another. You don't care for anyone
else's opinion or input.
bartc pisze:
On 27/10/2026 08:37, fir wrote:as to ideas I got an idea. Is your goal to stir up trouble here
bartc pisze:
On 26/10/2026 22:37, David Brown wrote:
#define fir_switch _Bool flag = 1; {It looks pretty good and it seems to work (the !flag needs the
#define or_if(...) } if (__VA_ARGS__) { flag = 0;
#define otherwise } if (!flag)
Then Fir can write :
˙˙˙˙˙fir_switch
˙˙˙˙˙or_if (x % 2 == 0) printf("\n divides by 2");
˙˙˙˙˙or_if (x % 3 == 0) printf("\n divides by 3");
˙˙˙˙˙otherwise printf("\n does not divide by 2 or 3");
I haven't tested the defines, and I think it is a terrible idea (it >>>>> should at least be called "and_if"), but it comes very close to the >>>>> syntax and semantics Fir appears to want.
reverse logic). The 'and_if' makes more sense too.
But of course it's not good enough for fir; there's always something.
blame the scienco fo doing just like tat
(one solution is a solution untill you find better one) ..im just
doing science here so its science to blame, i got no problem with that
I've no idea what you mean. And I've no idea what it is you're
actually after. I doubt anyone has. I doubt /you/ do!
You suggest some new statement type, in a C language forum, somebody
shows how to implement it in standard C, but your response is:
˙˙ "blame the scienco fo doing just like tat"
Not:
˙˙"Wow, thanks! That's perfect."
My guess is that you're not interested in actual solutions. You're
just thinking up one random idea after another. You don't care for
anyone else's opinion or input.
coz what yu say is like that and this is making bad content here
science does that science is finding a solution then it finds another solution so you may blame science and say you got idea what science is actually after
im just doin science - come to some conclusions than after that come to another conclusion...
why your should problems with science should interest me? im here for
doin science not to analyse personal problems of clc users
bartc pisze:
On 27/10/2026 08:37, fir wrote:
blame the scienco fo doing just like tat
(one solution is a solution untill you find better one) ..im just
doing science here so its science to blame, i got no problem with that
I've no idea what you mean. And I've no idea what it is you're
actually after. I doubt anyone has. I doubt /you/ do!
You suggest some new statement type, in a C language forum, somebody
shows how to implement it in standard C, but your response is:
˙˙ "blame the scienco fo doing just like tat"
Not:
˙˙"Wow, thanks! That's perfect."
My guess is that you're not interested in actual solutions. You're
just thinking up one random idea after another. You don't care for
anyone else's opinion or input.
coz what yu say is like that and this is making bad content here
science does that science is finding a solution then it finds another solution so you may blame science and say you got idea what science is actually after
im just doin science - come to some conclusions than after that come to another conclusion...posting reams of it in comp.lang.c as though it was your personal blog.
why your should problems with science should interest me? im here for
doin science not to analyse personal problems of clc usersYour 'science' seems to be writing mostly meaningless drivel and then
On 27/10/2026 11:57, fir wrote:
bartc pisze:
On 27/10/2026 08:37, fir wrote:
blame the scienco fo doing just like tat
(one solution is a solution untill you find better one) ..im just
doing science here so its science to blame, i got no problem with that
I've no idea what you mean. And I've no idea what it is you're
actually after. I doubt anyone has. I doubt /you/ do!
You suggest some new statement type, in a C language forum, somebody
shows how to implement it in standard C, but your response is:
˙˙ "blame the scienco fo doing just like tat"
Not:
˙˙"Wow, thanks! That's perfect."
My guess is that you're not interested in actual solutions. You're
just thinking up one random idea after another. You don't care for
anyone else's opinion or input.
coz what yu say is like that and this is making bad content hereposting reams of it in comp.lang.c as though it was your personal blog.
science does that science is finding a solution then it finds another
solution so you may blame science and say you got idea what science is
actually after
im just doin science - come to some conclusions than after that come
to another conclusion...
why your should problems with science should interest me? im here for
doin science not to analyse personal problems of clc usersYour
'science' seems to be writing mostly meaningless drivel and then
You don't seem to expect any feedback either, and tend to attack people
who offer opinions or try to make sense of some of your ideas.
I should have known from past experience that that never ends well.
'There's always something'.
bartc pisze:
On 27/10/2026 11:57, fir wrote:
bartc pisze:posting reams of it in comp.lang.c as though it was your personal blog.
On 27/10/2026 08:37, fir wrote:
blame the scienco fo doing just like tatI've no idea what you mean. And I've no idea what it is you're
(one solution is a solution untill you find better one) ..im just
doing science here so its science to blame, i got no problem with that >>>>
actually after. I doubt anyone has. I doubt /you/ do!
You suggest some new statement type, in a C language forum, somebody
shows how to implement it in standard C, but your response is:
˙˙ "blame the scienco fo doing just like tat"
Not:
˙˙"Wow, thanks! That's perfect."
My guess is that you're not interested in actual solutions. You're
just thinking up one random idea after another. You don't care for
anyone else's opinion or input.
coz what yu say is like that and this is making bad content here
science does that science is finding a solution then it finds another
solution so you may blame science and say you got idea what science
is actually after
im just doin science - come to some conclusions than after that come
to another conclusion...
why your should problems with science should interest me? im here for
doin science not to analyse personal problems of clc usersYour
'science' seems to be writing mostly meaningless drivel and then
You don't seem to expect any feedback either, and tend to attack
people who offer opinions or try to make sense of some of your ideas.
I should have known from past experience that that never ends well.
'There's always something'.
im not posting as personal blog and i answe a lot... the problem is you should first make soem work and understand what im talkin about and then answer it not just "i dont understand it so i will make z 10 hours of
foam here"
imagine what would come if anybody would start doing that agains ant
book move piece of science in book etc...
the amounts of foam would cover the sun :/ that would be word of foam
On 27/10/2026 11:57, fir wrote:
bartc pisze:
On 27/10/2026 08:37, fir wrote:
blame the scienco fo doing just like tat
(one solution is a solution untill you find better one) ..im just
doing science here so its science to blame, i got no problem with that
I've no idea what you mean. And I've no idea what it is you're
actually after. I doubt anyone has. I doubt /you/ do!
You suggest some new statement type, in a C language forum, somebody
shows how to implement it in standard C, but your response is:
˙˙ "blame the scienco fo doing just like tat"
Not:
˙˙"Wow, thanks! That's perfect."
My guess is that you're not interested in actual solutions. You're
just thinking up one random idea after another. You don't care for
anyone else's opinion or input.
coz what yu say is like that and this is making bad content hereposting reams of it in comp.lang.c as though it was your personal blog.
science does that science is finding a solution then it finds another
solution so you may blame science and say you got idea what science is
actually after
im just doin science - come to some conclusions than after that come
to another conclusion...
why your should problems with science should interest me? im here for
doin science not to analyse personal problems of clc usersYour
'science' seems to be writing mostly meaningless drivel and then
You don't seem to expect any feedback either, and tend to attack people
who offer opinions or try to make sense of some of your ideas.
I should have known from past experience that that never ends well.
'There's always something'.
On 27/10/2026 11:57, fir wrote:
posting reams of it in comp.lang.c as though it was your personal blog.
im just doin science - come to some conclusions than after that come
to another conclusion...
why your should problems with science should interest me? im here for
doin science not to analyse personal problems of clc usersYour
'science' seems to be writing mostly meaningless drivel and then
You don't seem to expect any feedback either, and tend to attack people
who offer opinions or try to make sense of some of your ideas.
I should have known from past experience that that never ends well.
'There's always something'.
On 27/10/2026 13:14, bartc wrote:
On 27/10/2026 11:57, fir wrote:
posting reams of it in comp.lang.c as though it was your personal blog.
im just doin science - come to some conclusions than after that come
to another conclusion...
why your should problems with science should interest me? im here for
doin science not to analyse personal problems of clc usersYour
'science' seems to be writing mostly meaningless drivel and then
You don't seem to expect any feedback either, and tend to attack
people who offer opinions or try to make sense of some of your ideas.
I should have known from past experience that that never ends well.
'There's always something'.
Bart, I think you just have to give up here.˙ You have tried hard to
give Fir help on what he asked for, with admirable patience, but all you
get back is insults and posts that look like a cat walked across his keyboard.˙ The guy has no idea about what he wants (nor what science
is), and can't express his half-baked thoughts.
Sometimes he makes posts that can lead to interesting C-related
discussions, but I think we are long past that in this thread.
David Brown pisze:
On 27/10/2026 13:14, bartc wrote:
On 27/10/2026 11:57, fir wrote:
posting reams of it in comp.lang.c as though it was your personal blog.
im just doin science - come to some conclusions than after that come
to another conclusion...
why your should problems with science should interest me? im here
for doin science not to analyse personal problems of clc usersYour
'science' seems to be writing mostly meaningless drivel and then
You don't seem to expect any feedback either, and tend to attack
people who offer opinions or try to make sense of some of your ideas.
I should have known from past experience that that never ends well.
'There's always something'.
Bart, I think you just have to give up here.˙ You have tried hard to
give Fir help on what he asked for, with admirable patience, but all
you get back is insults and posts that look like a cat walked across
his keyboard.˙ The guy has no idea about what he wants (nor what
science is), and can't express his half-baked thoughts.
Sometimes he makes posts that can lead to interesting C-related
discussions, but I think we are long past that in this thread.
david brown know bulshitter - i think its better to give up on this bulshitter in turn
what i want is not such low bulshitters talkin lies on me with no shamescience is), and can't express his half-baked thoughts." i assure it
fir pisze:
David Brown pisze:
On 27/10/2026 13:14, bartc wrote:
On 27/10/2026 11:57, fir wrote:
posting reams of it in comp.lang.c as though it was your personal blog. >>>>
im just doin science - come to some conclusions than after that
come to another conclusion...
why your should problems with science should interest me? im here
for doin science not to analyse personal problems of clc usersYour
'science' seems to be writing mostly meaningless drivel and then
You don't seem to expect any feedback either, and tend to attack
people who offer opinions or try to make sense of some of your ideas.
I should have known from past experience that that never ends well.
'There's always something'.
Bart, I think you just have to give up here.˙ You have tried hard to
give Fir help on what he asked for, with admirable patience, but all
you get back is insults and posts that look like a cat walked across
his keyboard.˙ The guy has no idea about what he wants (nor what
science is), and can't express his half-baked thoughts.
Sometimes he makes posts that can lead to interesting C-related
discussions, but I think we are long past that in this thread.
david brown know bulshitter - i think its better to give up on this
bulshitter in turn
its really need an idiot to write like that "The guy has no idea about
what he wants (nor what
science is), and can't express his half-baked thoughts."
fir pisze:
fir pisze:
David Brown pisze:
On 27/10/2026 13:14, bartc wrote:
On 27/10/2026 11:57, fir wrote:
posting reams of it in comp.lang.c as though it was your personal
im just doin science - come to some conclusions than after that
come to another conclusion...
why your should problems with science should interest me? im here >>>>>> for doin science not to analyse personal problems of clc usersYour >>>>>> 'science' seems to be writing mostly meaningless drivel and then
blog.
You don't seem to expect any feedback either, and tend to attack
people who offer opinions or try to make sense of some of your ideas. >>>>>
I should have known from past experience that that never ends well. >>>>> 'There's always something'.
Bart, I think you just have to give up here.˙ You have tried hard to
give Fir help on what he asked for, with admirable patience, but all
you get back is insults and posts that look like a cat walked across
his keyboard.˙ The guy has no idea about what he wants (nor what
science is), and can't express his half-baked thoughts.
Sometimes he makes posts that can lead to interesting C-related
discussions, but I think we are long past that in this thread.
david brown know bulshitter - i think its better to give up on this
bulshitter in turn
its really need an idiot to write like that "The guy has no idea about
what he wants (nor what
science is), and can't express his half-baked thoughts."
sorry it should be after newline ->
˙i assure it
˙what i want is not such low bulshitters talkin lies on me with no shame
note being weak mertihorically on c is a shame you both somewhat present
but talking such bulshit as you do personally its really much worse case
so i think you may stay conversating with you - you can be satisfied by level of shit you talk and we all be happy
i wouldnot need to read shamefull stupidity and lies and you could eat
this bulshit at free will
so ay hope we agree bulsiters talk with foam makers and keep out of commenting my topics - i would spare some time and personal disgust
On 27/10/2026 14:36, fir wrote:
so ay hope we agree bulsiters talk with foam makers and keep out of
commenting my topics - i would spare some time and personal disgust
Actually this was somebody else's thread.
bartc pisze:
On 27/10/2026 14:36, fir wrote:
so ay hope we agree bulsiters talk with foam makers and keep out of
commenting my topics - i would spare some time and personal disgust
Actually this was somebody else's thread.
well you got such a low iq that you dont understand if i state a post
iand some people comment on it it was i am talkin about
i hope david brown will stay with some bulshiters of his kind becuse
here such donkeys are not welcome....
so he also could be happy and i be happy.. its all good in such case
im spared to read such imbecile outcomes of stupidity
(like some people waste my time and this preposterous *** also thinks i should thank to them...
i once noted regular users are not so bad as they make this group work
but its not in case like that ehen someone flods preposterous imbecilism inside
(though he may return back after few months - we will se then...
im often disgusted by imbecile people but soon i will forget
unfortunatelly - which will open me on another outbusrt of imbecilism
on some random˙ donkey )
bartc pisze:
On 27/10/2026 14:36, fir wrote:
so ay hope we agree bulsiters talk with foam makers and keep out of
commenting my topics - i would spare some time and personal disgust
Actually this was somebody else's thread.
well you got such a low iq that you dont understand if i state a post
iand some people comment on it it was i am talkin about
i hope david brown will stay with some bulshiters of his kind becuse
here such donkeys are not welcome....
so he also could be happy and i be happy.. its all good in such case
im spared to read such imbecile outcomes of stupidity
(like some people waste my time and this preposterous *** also thinks i should thank to them...
i once noted regular users are not so bad as they make this group work
but its not in case like that ehen someone flods preposterous imbecilism inside
(though he may return back after few months - we will se then...
im often disgusted by imbecile people but soon i will forget
unfortunatelly - which will open me on another outbusrt of imbecilism
on some random˙ donkey )
On 27/10/2026 17:45, fir wrote:
bartc pisze:
On 27/10/2026 14:36, fir wrote:
so ay hope we agree bulsiters talk with foam makers and keep out of
commenting my topics - i would spare some time and personal disgust
Actually this was somebody else's thread.
well you got such a low iq that you dont understand if i state a post
iand some people comment on it it was i am talkin about
i hope david brown will stay with some bulshiters of his kind becuse
here such donkeys are not welcome....
so he also could be happy and i be happy.. its all good in such case
im spared to read such imbecile outcomes of stupidity
(like some people waste my time and this preposterous *** also thinks
i should thank to them...
i once noted regular users are not so bad as they make this group work
but its not in case like that ehen someone flods preposterous
imbecilism inside
(though he may return back after few months - we will se then...
im often disgusted by imbecile people but soon i will forget
unfortunatelly - which will open me on another outbusrt of imbecilism
on some random˙ donkey )
OK. That makes sense.
now those clowns appearing like here are really rare ocasins to me
Chris M. Thomasson pisze:
On 10/26/2026 2:40 PM, fir wrote:
bartc pisze:
Today was a bit of fun, but I can't take your ideas seriously.
definitely was not it was boring and a time waste ..i could do much
btter things
escept maybe cooking this example with if {} or if {}˙ else {}
this example is good as its small and shows the lacks of ifs and elses
logic in c (so its quite otable example)
but besides that it was timewaste
maybe to say - general discussion activity on clc is not a timewaste its quality time (sorta)
the waste is if someone dwells into a false things about things and you
not talk abour real things but false things and soeme here
can fund you such ride
then its a timewaste
Why are you wasting your time here on comp.lang.c?
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?
On 10/27/2026 3:51 AM, fir wrote:
Chris M. Thomasson pisze:
On 10/26/2026 2:40 PM, fir wrote:
bartc pisze:
Today was a bit of fun, but I can't take your ideas seriously.
definitely was not it was boring and a time waste ..i could do much
btter things
escept maybe cooking this example with if {} or if {}˙ else {}
this example is good as its small and shows the lacks of ifs and elses >>>> logic in c (so its quite otable example)
but besides that it was timewaste
maybe to say - general discussion activity on clc is not a timewaste
its quality time (sorta)
the waste is if someone dwells into a false things about things and
you not talk abour real things but false things and soeme here
can fund you such ride
then its a timewaste
Well, why not take some time off and learn C for yourself?
Why are you wasting your time here on comp.lang.c?
Chris M. Thomasson pisze:
On 10/27/2026 3:51 AM, fir wrote:
Chris M. Thomasson pisze:
On 10/26/2026 2:40 PM, fir wrote:
bartc pisze:
Today was a bit of fun, but I can't take your ideas seriously.
definitely was not it was boring and a time waste ..i could do much >>>>> btter things
escept maybe cooking this example with if {} or if {}˙ else {}
this example is good as its small and shows the lacks of ifs and elses >>>>> logic in c (so its quite otable example)
but besides that it was timewaste
maybe to say - general discussion activity on clc is not a timewaste
its quality time (sorta)
the waste is if someone dwells into a false things about things and
you not talk abour real things but false things and soeme here
can fund you such ride
then its a timewaste
Well, why not take some time off and learn C for yourself?
well i think i will not answer to you - more sense to be talking with a chicken or a dog than you...
talk with david brown or bartc for that matter
Why are you wasting your time here on comp.lang.c?
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?
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.
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.
In article <slrn11e2aa4.2i9.dan@djph.net>, 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.
In article <slrn11e2aa4.2i9.dan@djph.net>, 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.
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <slrn11e2aa4.2i9.dan@djph.net>, 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.
He doesn't want to. He's made it clear that taking the time to
write clearly is beneath him. That's not going to change.
Replying to him is a waste of everyone's time.
Keith Thompson wrote:[...]
He doesn't want to. He's made it clear that taking the time toAnd then there's Keith Thompson. He makes mistake after mistake, yet
write clearly is beneath him. That's not going to change.
Replying to him is a waste of everyone's time.
keeps on trucking never apologizing. He's a waste of everyone's
time. Go ahead and killfile this guy. I guess I don't mind and it will improve upon the experience you are having.
Lawrence D?Oliveiro <ldo@nz.invalid> writes:
On Fri, 23 Oct 2026 18:33:56 -0700, Chris M. Thomasson wrote:
On 10/23/2026 3:40 PM, Lawrence D?Oliveiro wrote:
The trouble with a fixed name is, how do you refer to the instance
of an outer class?
Well, self can be internal to the API logic.
If ?self? refers to the current instance of the innermost class, how
do you refer to an instance of an outer class?
What's a "class"?
There are ways to implement or simulate classes and inheritance in C.
Without knowing how that's being done, it's not very meaningful to ask
how to refer to an instance of an outer class.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Lawrence D?Oliveiro <ldo@nz.invalid> writes:
On Fri, 23 Oct 2026 18:33:56 -0700, Chris M. Thomasson wrote:
On 10/23/2026 3:40 PM, Lawrence D?Oliveiro wrote:
The trouble with a fixed name is, how do you refer to the instance
of an outer class?
Well, self can be internal to the API logic.
If ?self? refers to the current instance of the innermost class, how
do you refer to an instance of an outer class?
What's a "class"?
an object is a data structure that has an identity. I remeber this from
a long time ago. A class i dunno.
To access an ``outer'' class, or a nested object, would depend on the programming language. I would recommend GCC. it allows for nested
functions. Just stick the functions into a vector and well...
On Sat, 24 Oct 2026 21:42:50 -0700, Chris M. Thomasson wrote:
_this good, _This bad?
If asked ?how many letters are there in the English alphabet??, what
answer do you think (normal) people are more likely to give: ?26? or
?52??
I think the instinctive answer most people would give is ?26?.
On 26/10/2026 12:07, fir wrote:
fir pisze:Excellent. A great thing about this is, this can also be legal C, that works now, if you just precede with this:
if {} or if {} or if {} else {}this form in fact is not bad, it simply showst two things
1) you may use or outside the if clause (if this () can be named clause)
2) else in fact work on logical group but ias sole if is alos a case of
logical group so else work on it sole in special case
otherwiste thse keywords here if or and else are quite 'legit'
if () {}
or if () {}
or if() {}
else {}
seems quite legit and it seem to ba a switch
#define or else
On 2026-10-28 00:00, Dan Cross wrote:
In article <slrn11e2aa4.2i9.dan@djph.net>, 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.)
Janis
PS: Related question: Why do some folks here play the role of the
AI and continuously feed him.
Keith Thompson wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:And then there's Keith Thompson. He makes mistake after mistake, yet
In article <slrn11e2aa4.2i9.dan@djph.net>, 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:The lazy/incoherent way fir writes ... I can't see his CV getting past >>>>> the AI vetting stage.
[...]
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? >>>>>
It's okay, he used AI.
But seriously though why can't he use AI for his spelling and
grammar.
He doesn't want to.˙ He's made it clear that taking the time to
write clearly is beneath him.˙ That's not going to change.
Replying to him is a waste of everyone's time.
keeps on trucking never apologizing. He's a waste of everyone's time. Go ahead and killfile this guy. I guess I don't mind and it will improve
upon the experience you are having.
Keith Thompson wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:And then there's Keith Thompson. He makes mistake after mistake, yet
In article <slrn11e2aa4.2i9.dan@djph.net>, 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:The lazy/incoherent way fir writes ... I can't see his CV getting past >>>>> the AI vetting stage.
[...]
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? >>>>>
It's okay, he used AI.
But seriously though why can't he use AI for his spelling and
grammar.
He doesn't want to.˙ He's made it clear that taking the time to
write clearly is beneath him.˙ That's not going to change.
Replying to him is a waste of everyone's time.
keeps on trucking never apologizing. He's a waste of everyone's time. Go ahead and killfile this guy. I guess I don't mind and it will improve
upon the experience you are having.
Blaine pisze:
Keith Thompson wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:And then there's Keith Thompson. He makes mistake after mistake, yet
In article <slrn11e2aa4.2i9.dan@djph.net>, 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:The lazy/incoherent way fir writes ... I can't see his CV getting >>>>>> past
[...]
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 AI vetting stage.
It's okay, he used AI.
But seriously though why can't he use AI for his spelling and
grammar.
He doesn't want to.˙ He's made it clear that taking the time to
write clearly is beneath him.˙ That's not going to change.
Replying to him is a waste of everyone's time.
keeps on trucking never apologizing. He's a waste of everyone's time.
Go ahead and killfile this guy. I guess I don't mind and it will
improve upon the experience you are having.
the fact that KT has very strong aspect of clown youre not frst to
notice,˙ i noticed it strikes˙˙˙˙ quite a dose of people
overally quite a dose of people are also clowns (as they are mental reductionists and they acct accordingly )
DB would be a hevier one here (also ocassionally) becouse some heavy
words of
shameless stupidity is really to much
fir pisze:
DB would be a hevier one here (also ocassionally) becouse some heavyhe was strictly talking bulshit lies on me and that is really too much
words of
shameless stupidity is really to much
- and its fortunatelly not quite common here and better stays this way..
if someone talks such heavy bulshit lies to me that kind of fella is
lost, i ca help him not io want to talk with such low people able to do
that - its below every standard
case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
default // 1 5 7 11 13
maybe try with like
case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
No, cases '6' and '12' are also true for x%2==0. Unless you want these
to be non-exclusive?
default // 1 5 7 11 13
bartc wrote:
maybe try with like
case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
No, cases '6' and '12' are also true for x%2==0. Unless you want these
to be non-exclusive?
default˙ // 1 5 7 11 13
You can do guards with C syntax.
if (x%2==0) {...; goto out;}
if (x%3==0) {...; goto out;}
...
{default action....} out:;
On 28/10/2026 08:24, fir wrote:
fir pisze:
DB would be a hevier one here (also ocassionally) becouse some heavyhe was strictly talking bulshit lies on me and that is really too much
words of
shameless stupidity is really to much
- and its fortunatelly not quite common here and better stays this way..
if someone talks such heavy bulshit lies to me that kind of fella is
lost, i ca help him not io want to talk with such low people able to
do that - its below every standard
So in your opinion which are the 'high' people who post here?
Apart from you of course; you might possibly be the highest.
chine.bleu pisze:
bartc wrote:
maybe try with like
case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
No, cases '6' and '12' are also true for x%2==0. Unless you want these
to be non-exclusive?
default˙ // 1 5 7 11 13
You can do guards with C syntax.
if (x%2==0) {...; goto out;}
if (x%3==0) {...; goto out;}
...
{default action....} out:;
not really, guess why
besides the construcj are to write things cleaner and easier to read,
more tidy..and if soe imo couple of construct should be present
for some cases
if none(a,b,c)˙ then {} else {} would be ok for other
if (){} or if() {} else {} is not bad
0 and x<w {}
0, x<w some {} none {} both {} //??
dictionary is also ok (i was writing in inviting dictionaries in c back then) or this goto (number) is also ok
if-else as it is today i find incomplete and switch as it is i find ugly (though if some well realizes its in fact goto it may be seen better imo (realizing its goto made it it have a bit more value in my etyes - but
stil its badly done goto and its ugly
fir wrote:
case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
default˙ // 1 5 7 11 13
What is your war using C reserved words in existing syntax?
[...] to write things cleaner and easier to read [...]
Lawrence D?Oliveiro <ldo@nz.invalid> writes:
If asked ?how many letters are there in the English alphabet??, what
answer do you think (normal) people are more likely to give: ?26? or
?52??
I think the instinctive answer most people would give is ?26?.
128
if you count space, ; : ; 1 0 & ~
bartc wrote:
maybe try with like
case x%2==0 //2 4 6 8 10 12
case x%3==0 //3 6 9 12
No, cases '6' and '12' are also true for x%2==0. Unless you want these
to be non-exclusive?
default˙ // 1 5 7 11 13
You can do guards with C syntax.
if (x%2==0) {...; goto out;}
if (x%3==0) {...; goto out;}
...
{default action....} out:;
Blaine <cactus_DAC@yahoo.com> writes:
Keith Thompson wrote:[...]
He doesn't want to. He's made it clear that taking the time toAnd then there's Keith Thompson. He makes mistake after mistake, yet
write clearly is beneath him. That's not going to change.
Replying to him is a waste of everyone's time.
keeps on trucking never apologizing. He's a waste of everyone's
time. Go ahead and killfile this guy. I guess I don't mind and it will
improve upon the experience you are having.
Oh, great, another one.
This "Blaine" person has apparently made up some weird fantasy
about me, based on a recent brief interaction in comp.os.linux.misc
and comp.lang.python. I suggest not engaging with his attempted
harassment.
On 2026-10-28 07:26, steve g wrote:
Lawrence D?Oliveiro <ldo@nz.invalid> writes:
If asked ?how many letters are there in the English alphabet??, what
answer do you think (normal) people are more likely to give: ?26? or
?52??
Since I'm not sure you were just joking let me finish with my opinion:
Unless the correct answer is 42 it certainly is 26.
On 2026-10-28 03:21, Keith Thompson wrote:
Blaine <cactus_DAC@yahoo.com> writes:
Keith Thompson wrote:[...]
He doesn't want to.˙ He's made it clear that taking the time toAnd then there's Keith Thompson. He makes mistake after mistake, yet
write clearly is beneath him.˙ That's not going to change.
Replying to him is a waste of everyone's time.
keeps on trucking never apologizing. He's a waste of everyone's
time. Go ahead and killfile this guy. I guess I don't mind and it will
improve upon the experience you are having.
Oh, great, another one.
This "Blaine" person has apparently made up some weird fantasy
about me, based on a recent brief interaction in comp.os.linux.misc
and comp.lang.python.˙ I suggest not engaging with his attempted
harassment.
Interestingly I don't see his post. (He seems to be in my killfile.)
A long period of time must have passed since then since I even don't
recall his name.
I think people can make an educated decision themselves about whom
they killfile and how they waste their time. ;-)
Janis Papanagnou wrote:
On 2026-10-28 07:26, steve g wrote:
Lawrence D?Oliveiro <ldo@nz.invalid> writes:
If asked ?how many letters are there in the English alphabet??, what
answer do you think (normal) people are more likely to give: ?26? or
?52??
Since I'm not sure you were just joking let me finish with my opinion:
Unless the correct answer is 42 it certainly is 26.
Look at this guy just ignore Lawrence's question completely. No evidence presented, nothing to support his claim, just hereby making a wrong statement. I think we should all kill file this guy. The newsgroup would have an improvement, don't you agree?
Blaine pisze:
Janis Papanagnou wrote:
On 2026-10-28 07:26, steve g wrote:
Lawrence D?Oliveiro <ldo@nz.invalid> writes:
If asked ?how many letters are there in the English alphabet??, what >>>>> answer do you think (normal) people are more likely to give: ?26? or >>>>> ?52??
Since I'm not sure you were just joking let me finish with my opinion:
Unless the correct answer is 42 it certainly is 26.
Look at this guy just ignore Lawrence's question completely. No
evidence presented, nothing to support his claim, just hereby making a
wrong statement. I think we should all kill file this guy. The
newsgroup would have an improvement, don't you agree?
i just clownfiled keith thompson..he kilfilled me i can clownfile him
and who is better here?
fir pisze:
Blaine pisze:
Janis Papanagnou wrote:
On 2026-10-28 07:26, steve g wrote:
Lawrence D?Oliveiro <ldo@nz.invalid> writes:
If asked ?how many letters are there in the English alphabet??, what >>>>>> answer do you think (normal) people are more likely to give: ?26? or >>>>>> ?52??
Since I'm not sure you were just joking let me finish with my opinion: >>>> Unless the correct answer is 42 it certainly is 26.
Look at this guy just ignore Lawrence's question completely. No
evidence presented, nothing to support his claim, just hereby making
a wrong statement. I think we should all kill file this guy. The
newsgroup would have an improvement, don't you agree?
i just clownfiled keith thompson..he kilfilled me i can clownfile him
and who is better here?
what if i say i automatically clownfile all that killfile me - they
should be warned :/
On 2026-10-28 03:21, Keith Thompson wrote:
Blaine <cactus_DAC@yahoo.com> writes:
Keith Thompson wrote:
[...]
He doesn't want to. He's made it clear that taking the time to
write clearly is beneath him. That's not going to change.
Replying to him is a waste of everyone's time.
And then there's Keith Thompson. He makes mistake after mistake, yet
keeps on trucking never apologizing. He's a waste of everyone's
time. Go ahead and killfile this guy. I guess I don't mind and it will >>> improve upon the experience you are having.
Oh, great, another one.
This "Blaine" person has apparently made up some weird fantasy
about me, based on a recent brief interaction in comp.os.linux.misc
and comp.lang.python. I suggest not engaging with his attempted
harassment.
Interestingly I don't see his post. (He seems to be in my killfile.)
A long period of time must have passed since then since I even don't
recall his name.
I think people can make an educated decision themselves about whom
they killfile and how they waste their time. ;-)
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.
On 28/10/2026 03:06, Blaine wrote:
Keith Thompson wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:And then there's Keith Thompson. He makes mistake after mistake, yet
In article <slrn11e2aa4.2i9.dan@djph.net>, 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:The lazy/incoherent way fir writes ... I can't see his CV getting >>>>>> past
[...]
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 AI vetting stage.
It's okay, he used AI.
But seriously though why can't he use AI for his spelling and
grammar.
He doesn't want to.˙ He's made it clear that taking the time to
write clearly is beneath him.˙ That's not going to change.
Replying to him is a waste of everyone's time.
keeps on trucking never apologizing. He's a waste of everyone's time.
Go ahead and killfile this guy. I guess I don't mind and it will
improve upon the experience you are having.
Keith is a big part of why there still is a comp.lang.c group, and why people ask questions and discuss C here.˙ His knowledge, patience, and willingness to help people interested in C is legendary - as is his impatience and intolerance of trolls and rudeness.˙ Sure, he
occasionally makes mistakes - but not often, and he makes a point of correcting them.
If you don't like Keith's posts, I'd recommend you simply unsubscribe
from comp.lang.c.
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
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
On 2026-10-28 03:21, Keith Thompson wrote:
Blaine <cactus_DAC@yahoo.com> writes:
Keith Thompson wrote:
[...]
He doesn't want to. He's made it clear that taking the time to
write clearly is beneath him. That's not going to change.
Replying to him is a waste of everyone's time.
And then there's Keith Thompson. He makes mistake after mistake, yet
keeps on trucking never apologizing. He's a waste of everyone's
time. Go ahead and killfile this guy. I guess I don't mind and it will >>>> improve upon the experience you are having.
Oh, great, another one.
This "Blaine" person has apparently made up some weird fantasy
about me, based on a recent brief interaction in comp.os.linux.misc
and comp.lang.python. I suggest not engaging with his attempted
harassment.
Interestingly I don't see his post. (He seems to be in my killfile.)
A long period of time must have passed since then since I even don't
recall his name.
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.
I think people can make an educated decision themselves about whom
they killfile and how they waste their time. ;-)
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?
This "Blaine" person has apparently made up some weird fantasy
about me, based on a recent brief interaction in comp.os.linux.misc
and comp.lang.python. I suggest not engaging with his attempted
harassment.
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...
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 wrongYou seem fixated on that 'or'. Either use 'else', or create 'or' as
you cant
an alias as I suggested.
imo you should try to understand the example
for(int i = 1; i < 20; i++)
{
˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n divides by 2");
˙˙˙˙˙ or if(x%3==0) printf("\n divides by 3");
˙˙˙˙˙ else˙ printf("\n no divides (by 2 or 3)");
}
you understand how this would work? i think you do
and how in normal c without this "or" it would look,
for exampel in your if else model?
Show me exactly what the output should be, when it is written like this:
˙˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n%d divides by 2", i);
˙˙˙˙˙˙ or if(x%3==0) printf("\n%d divides by 3", i);
˙˙˙˙˙˙ else˙ printf("\n%d no divides (by 2 or 3)", i);
You might also want to look at the FizzBuzz program.
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)
On 2026-10-28 19:59, Tim Rentsch wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
On 2026-10-28 03:21, Keith Thompson wrote:
Blaine <cactus_DAC@yahoo.com> writes:
Keith Thompson wrote:
[...]
He doesn't want to.˙ He's made it clear that taking the time to
write clearly is beneath him.˙ That's not going to change.
Replying to him is a waste of everyone's time.
And then there's Keith Thompson.˙ He makes mistake after mistake, yet >>>>> keeps on trucking never apologizing.˙ He's a waste of everyone's
time.˙ Go ahead and killfile this guy.˙ I guess I don't mind and it >>>>> will
improve upon the experience you are having.
Oh, great, another one.
This "Blaine" person has apparently made up some weird fantasy
about me, based on a recent brief interaction in comp.os.linux.misc
and comp.lang.python.˙ I suggest not engaging with his attempted
harassment.
Interestingly I don't see his post.˙ (He seems to be in my killfile.)
A long period of time must have passed since then since I even don't
recall his name.
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".
Now you were responding to me, someone responding to a "blatherskite's blatherskite" person, which by above (absolutely pointless) recursive definition is also a "blatherskite". And since you respond to me, per
(your) definition a blatherskite's blatherskite's blatherskite person,
you are a blatherskite's blatherskite's blatherskite's blatherskite.
Wow.
Was it clever to provide such a definition outing you as blatherskite?
Have we won any insight by your post? (I mean other than what we know
already about you, or about anyone else here.)
Better abstain and leave the decisions who is posting what and replying
to whom to the individuals here. In case you missed it; above quoted:
I think people can make an educated decision themselves about whom
they killfile and how they waste their time. ;-)
In your case please substitute˙ ". ;-)"˙ by˙ "! :-/"˙ in my quote, as
you seem to have had issues understanding that.
Thanks.
Janis, trap ignore SIGTIM
for(x=1;x<20;++x)
{if(x%2==0) printf("%d divides by 2\n",x);
if(x%3==0) printf("%d divides by 3\n",x);
if(x%3!=0&&x%2!=0)
printf("%d no divides (by 3 or 2)\n",x);
}
Janis Papanagnou pisze:
On 2026-10-28 19:59, Tim Rentsch wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
On 2026-10-28 03:21, Keith Thompson wrote:
Blaine <cactus_DAC@yahoo.com> writes:
Keith Thompson wrote:
[...]
He doesn't want to.˙ He's made it clear that taking the time to
write clearly is beneath him.˙ That's not going to change.
Replying to him is a waste of everyone's time.
And then there's Keith Thompson.˙ He makes mistake after mistake, yet >>>>>> keeps on trucking never apologizing.˙ He's a waste of everyone's
time.˙ Go ahead and killfile this guy.˙ I guess I don't mind and
it will
improve upon the experience you are having.
Oh, great, another one.
This "Blaine" person has apparently made up some weird fantasy
about me, based on a recent brief interaction in comp.os.linux.misc
and comp.lang.python.˙ I suggest not engaging with his attempted
harassment.
Interestingly I don't see his post.˙ (He seems to be in my killfile.)
A long period of time must have passed since then since I even don't
recall his name.
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".
Now you were responding to me, someone responding to a "blatherskite's
blatherskite" person, which by above (absolutely pointless) recursive
definition is also a "blatherskite". And since you respond to me, per
(your) definition a blatherskite's blatherskite's blatherskite person,
you are a blatherskite's blatherskite's blatherskite's blatherskite.
Wow.
in my part of clc i participated this snake began with bartc (as far as
i remember at least)..
Was it clever to provide such a definition outing you as blatherskite?
Have we won any insight by your post? (I mean other than what we know
already about you, or about anyone else here.)
Better abstain and leave the decisions who is posting what and replying
to whom to the individuals here. In case you missed it; above quoted:
I think people can make an educated decision themselves about whom
they killfile and how they waste their time. ;-)
In your case please substitute˙ ". ;-)"˙ by˙ "! :-/"˙ in my quote, as
you seem to have had issues understanding that.
Thanks.
Janis, trap ignore SIGTIM
On Thu, 29 Oct 2026 08:30:33 +0100, Rosario19 wrote:
for(x=1;x<20;++x)
{if(x%2==0) printf("%d divides by 2\n",x);
if(x%3==0) printf("%d divides by 3\n",x);
if(x%3!=0&&x%2!=0)
printf("%d no divides (by 3 or 2)\n",x);
}
int y,x=0;
label:
y=1;++x;
if(x%2==0) {printf("%d divides by 2\n",x);y=0;}
if(x%3==0) {printf("%d divides by 3\n",x);y=0;}
if(y)printf("%d no divides (by 3 or 2)\n",x);
if(x<20)goto label;
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.
imo you should try to understand the example
for(int i = 1; i < 20; i++)
{
˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n divides by 2");
˙˙˙˙˙ or if(x%3==0) printf("\n divides by 3");
˙˙˙˙˙ else˙ printf("\n no divides (by 2 or 3)");
}
you understand how this would work? i think you do
and how in normal c without this "or" it would look,
for exampel in your if else model?
Show me exactly what the output should be, when it is written like this: >>>
˙˙˙˙˙˙˙˙˙ if(x%2==0) printf("\n%d divides by 2", i);
˙˙˙˙˙˙ or if(x%3==0) printf("\n%d divides by 3", i);
˙˙˙˙˙˙ else˙ printf("\n%d no divides (by 2 or 3)", i);
You might also want to look at the FizzBuzz program.
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)
for(x=1;x<20;++x)
{if(x%2==0) printf("%d divides by 2\n",x);
if(x%3==0) printf("%d divides by 3\n",x);
if(x%3!=0&&x%2!=0)
printf("%d no divides (by 3 or 2)\n",x);
}
What is your war using C reserved words in existing syntax?
its for illustrartion
[ 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˙ 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:
[...]?˙ (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.˙ Vast majority of early exits is done
via 'return'.˙ "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.˙ But
reasonable guestimate to that there are tens such uses.˙ In
a sense that is common, that is significantly more than one
case.˙ If my guestimate is correct, then this may be nontrivial
fraction of all uses of 'break'.˙ OTOH that is tiny fraction
of all loops.
˙From my (personal) perspective, I commonly have two types of
such specific constructs; a very common one is iterating over
options
˙˙ while ((opt = getopts (...)) != -1)
˙˙˙˙ 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
˙˙ while ((token = parse (...)) != END_TOKEN)
˙˙˙˙ 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
˙˙ int leaving = 0;
˙˙ while ((token = parse (&token...)) != ERROR˙ &&˙ !leaving)
˙˙˙˙ switch (token)
˙˙˙˙˙˙ 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 ?for (;;)?. I
also try to avoid putting ?return? 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 DOliveiro <>
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 ?for (;;)?.
I also try to avoid putting ?return? 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?
[...]
| Sysop: | Tetrazocine |
|---|---|
| Location: | Melbourne, VIC, Australia |
| Users: | 4 |
| Nodes: | 8 (0 / 8) |
| Uptime: | 190:54:34 |
| Calls: | 222 |
| Files: | 21,513 |
| Messages: | 85,912 |