🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #515

Re: Taming The Switch-Statement

#515
From: Janis Papanagnou
Date: Sun, 18 Oct 2026 16:11
35 lines
2966 bytes
On 2026-10-18 17:26, Michael S wrote:
> On Sun, 18 Oct 2026 16:58:38 +0200
> David Brown <david.brown@hesbynett.no> wrote:
>> On 18/10/2026 16:24, Michael S wrote:
[...]
>>> It would be interesting to find out why designers of C, or of one
>>> of its ancestors decided that * as prefix is preferable to * as
>>> postfix.

Because it is more "natural" when read, easier to grasp? Simpler
for compilers? More consistent if all other, especially standard
operators known from daily use are used in prefix-form (-5, +42,
!false, ~bitset) in expressions?

I don't recall to have used any language with infix-expressions
that would have their monadic operators defined in postfix form.
The only exception was "C" (and C-oriented languages) with their
special case of post-increment/post-decrement operators. (Think
also about the quirk in C++ to define monadic postfix operators
that require a syntactic dummy type argument). (In low-level RPN
systems it may appear more "natural", but that just aside.)

>>> Were they afraid of confusion with usage of * as
>>> multiplication? Probably not, because confusion can arise about
>>> equally both for prefix and for postfix.
>>
>> I don't know why it is prefix.  Maybe they were keen on "*p++ = *q++"
>> and similar expressions, felt "(p++)* = (q++)*" was unclear?
> 
> Why would it require parentheses?

Not necessarily (I think).

Janis
Technical Details
Message-ID: <11b2r36$3pvda$8@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>

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: Sun, 18 Oct 2026 18:11:18 +0200
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <11b2r36$3pvda$8@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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 18 Oct 2026 16:11:19 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3997098"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+P+L5L/WWBSfdUfRJJju0J"; posting-host="413ca35758bf2644217f2957a34a3916"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Mo6gBeoH2cvWv1qWXC8u38Zjcic= sha256:4SIN06UtZu6gcIibDxxyTcotWzoXxpZBl+VNjABl/UE=
	sha1:mBUFyr2oMFVZhJwWDVrThtX24Bg= sha256:67lJv+q7t9T0JykV0yDbv/DZTNXSNg/YTuPVxpFGEWI=
Content-Language: en-US
In-Reply-To: <20261018182627.00001934@yahoo.com>