🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #567

Re: Taming The Switch-Statement

#567
From: Janis Papanagnou
Date: Mon, 19 Oct 2026 21:27
70 lines
4620 bytes
On 2026-10-19 21:35, Michael S wrote:
> On Mon, 19 Oct 2026 15:44:40 +0200
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
> 
>> On 2026-10-18 18:32, Michael S wrote:
>>> On Sun, 18 Oct 2026 18:11:18 +0200
>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>>>>
>>>> I don't recall to have used any language with infix-expressions
>>>> that would have their monadic operators defined in postfix form.
>>>
>>> I am a Bear of Very Little Brain, and long words Bother Me.
>>
>> (If that quote is important for your argument, please explain.)
>>
> 
> Translation:
> 1. I have no idea what unary * has to do with infix-expressions
> 2. I don't appriciate use of the term "infix-expression" instead of more
> common (in context of description of C and similar languages) term
> 'binary operators'.
> 3. I don't know what "monadic operators defined in postfix form" means
> and have no plans to look for the meaning
> 

I'm sorry, these are (AFAICT) common terms, and I thought obvious.
So let me explain and amend with more text and examples...

Point 1. - I gave the hint that in languages that support RPN
(= Reverse Polish Notation) things like monadic postfix operators
(= having just _one_ argument applied _after_ the operator) are the
natural way of writing expressions. Less so in languages, which are
the majority since decades, that support expressions with infix
operators (= the operator arguments left and right of the operator).

Point 2. - A "binary operator" may be the '*' in the expressions
   a * b     typical infix notation (with parenthesis for precedence)
   a b *     RPN
   * a b     PN (Polish Notation)

A "binary operator" is something different from an "infix expression"
(the first one of the three; the others are RPN and PN examples).
That's why I took the appropriate term to explain what I intended to
explain.

Point 3. - "monadic" (see point 1). Applying to postfix form is best
explained on another example; assume RPN
   a -       monadic (unary) minus (on one argument)
   a b -     dyadic (binary) minus (difference of two arguments)

Hope the terms are clear now. Now consider our original case, e.g.

   a * *b ...     multiply and dereference
   a - -b ...     subtract and negate

as soon as we parse the second operator we know its kind. With postfix
operators we'd have (assuming same semantics but with postfix operators)

   a * b * ...    now what is the second '*' at that point of parsing?
   a - b - ...    we don't expect that second '-' to be a negation.

The compilers can handle every variant. For the users it's different;
usually they seem to prefer unary operators to be prefixed (YMMV).

The question (concerning "C") was; would it have been "better" (in any
respect) if the dereferencing operator would have been defined in "C"
as postfix operator (as you seem to prefer).

Janis
Technical Details
Message-ID: <11b61v8$1kr9u$6@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <119qf6l$2rmg3$1@dont-email.me> <11arjmc$2qid7$1@dont-email.me> <11at5vi$5vu$1@reader2.panix.com> <11auad0$3no1k$1@dont-email.me> <11aupfl$3ul$1@reader2.panix.com> <11avmfb$55rt$1@dont-email.me> <11b2a6d$131h6$1@dont-email.me> <20261018172446.00002d43@yahoo.com> <11b2mqu$16mof$3@dont-email.me> <20261018182627.00001934@yahoo.com> <11b2r36$3pvda$8@dont-email.me> <20261018193201.00000b13@yahoo.com> <11b56s8$1kr9u$2@dont-email.me> <20261019223538.00006521@yahoo.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Mon, 19 Oct 2026 23:27:03 +0200
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <11b61v8$1kr9u$6@dont-email.me>
References: <119qf6l$2rmg3$1@dont-email.me> <11arjmc$2qid7$1@dont-email.me>
 <11at5vi$5vu$1@reader2.panix.com> <11auad0$3no1k$1@dont-email.me>
 <11aupfl$3ul$1@reader2.panix.com> <11avmfb$55rt$1@dont-email.me>
 <11b2a6d$131h6$1@dont-email.me> <20261018172446.00002d43@yahoo.com>
 <11b2mqu$16mof$3@dont-email.me> <20261018182627.00001934@yahoo.com>
 <11b2r36$3pvda$8@dont-email.me> <20261018193201.00000b13@yahoo.com>
 <11b56s8$1kr9u$2@dont-email.me> <20261019223538.00006521@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 19 Oct 2026 21:27:04 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1731902"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19l8PAHbaILX7fXIaZZSOsl"; posting-host="9a1787de1638a6d9f83c958712c1b12a"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ISsD/1Oc9eyvKsF6h9oozFqKqgs= sha256:LnGRlG2aIxYAhWALILQy50MxUxc32ypJeCfURoCTBFc=
	sha1:CSnkKBdnLf/uTdS0SLhVoolZlZ8= sha256:e1NskaetYduxCVQbo1awFJwnvXu92NQQVzFPxLhqahs=
Content-Language: en-US
In-Reply-To: <20261019223538.00006521@yahoo.com>