Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > muc.lists.netbsd.source-changes > #156208
| From | Robert Elz <kre@munnari.OZ.AU> |
|---|---|
| Newsgroups | muc.lists.netbsd.source-changes |
| Subject | Re: The --> "operator" (was: Re: CVS commit: src/sys/uvm) |
| Date | 2026-07-09 06:59 +0700 |
| Organization | Newsgate at muc.de e.V. |
| Message-ID | <752.1783555181@jacaranda.noi.kre.to> (permalink) |
| References | <20260708153102.C64DD84DA8@mail.netbsd.org> |
Date: Wed, 8 Jul 2026 15:31:01 +0000
From: Taylor R Campbell <riastradh@NetBSD.org>
Message-ID: <20260708153102.C64DD84DA8@mail.netbsd.org>
| I can tell you in a second _one_ of them is definitely correct, and
| for _every other one_ it'll take me at least a few seconds if not a
| few minutes to think about.
Really?
| for (i = N; i --> 0;) { ... i ... }
That one, which is the one you (claim to) prefer, and
| for (i = N; i-- > 0;} { ... i ... }
this one, which is in KNF (ignoring the statement part), differ by
exactly the positioning of one (unnecessary) space.
for (i=N;i-->0;} { ... i ...}
is just the same, compressed a bit (I am not suggesting that be used).
You're really unable to see that these 3 all do the exact same thing in more
than about a millisecond?
And KNF does say to surround binary operators (of which '>' is one)
with spaces (--> isn't an operator, it is two). But KNF's stance on
that is kind of meaningless, as no-one surrounds -> . or [ with spaces,
and yet all are binary operators in C.
kre
ps: while C has not had a habit of inventing new operators (the # and ##
preprocessor operators are the only ones I can think of) in general it
is unwise to run operators into each other, as if someone should decide
to invent a --> operator, and it doesn't do what the two operators it
now represents do, then any use of that would break, whereas -- > never
will.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Back to muc.lists.netbsd.source-changes | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: The --> "operator" (was: Re: CVS commit: src/sys/uvm) Taylor R Campbell <riastradh@NetBSD.org> - 2026-07-08 15:31 +0000
Re: The --> "operator" (was: Re: CVS commit: src/sys/uvm) Robert Elz <kre@munnari.OZ.AU> - 2026-07-09 06:59 +0700
Re: The --> "operator" (was: Re: CVS commit: src/sys/uvm) Valery Ushakov <uwe@stderr.spb.ru> - 2026-07-09 13:22 +0300
Re: The --> "operator" (was: Re: CVS commit: src/sys/uvm) Robert Elz <kre@munnari.OZ.AU> - 2026-07-09 18:41 +0700
Re: The --> "operator" (was: Re: CVS commit: src/sys/uvm) Taylor R Campbell <riastradh@NetBSD.org> - 2026-07-09 23:18 +0000
Re: The --> "operator" Greg Troxel <gdt@lexort.com> - 2026-07-09 12:53 -0400
csiph-web