Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > muc.lists.netbsd.source-changes > #156205

Re: The --> "operator"

From Greg Troxel <gdt@lexort.com>
Newsgroups muc.lists.netbsd.source-changes
Subject Re: The --> "operator"
Date 2026-07-08 07:44 -0400
Organization Newsgate at muc.de e.V.
Message-ID <rmijyr51z9x.fsf@s1.lexort.com> (permalink)
References <> <ak42n8pOg9_S7toI@big-apple.aprisoft.de>

Show all headers | View raw


Martin Husemann <martin@duskware.de> writes:

> On Wed, Jul 08, 2026 at 06:56:01AM -0400, Greg Troxel wrote:
>> I have never seen --> in C, from reading K&R in 1977 to now.  It looks
>> like something made up by C++ :-) But seriously, I find it unhelpful.
>> The semantics of --i and i-- are clear and have been stable for years,
>> as are the semantics of > and >=.
>
> There is nothing special about it, and it doesn't matter if you
> write it as -- > or --> and give the latter a cute name.
>
> It is two operators, post-decrement and greater-than and it has been
> there from the beginning.

I meant that writing it as "-->" is irregular, and I find it unhelpful.

I also find i-- in a for loop update step (middle) to be unhelpful for
clarity, as the test is done on a different value that the loop sees.

This feels like "it's twice as hard to debug code than to write it, so
only write code that is half as clever as you are capable of".  I found
that "writing for the code reviewer" led to code that was as simple and
clear as it could be, and this helped reliability, back when I was
in an environment with review.

--
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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: The --> "operator" Greg Troxel <gdt@lexort.com> - 2026-07-08 06:56 -0400
  Re: The --> "operator" Martin Husemann <martin@duskware.de> - 2026-07-08 13:38 +0200
    Re: The --> "operator" Greg Troxel <gdt@lexort.com> - 2026-07-08 07:44 -0400
      Re: The --> "operator" "Jonathan A. Kollasch" <jakllsch@kollasch.net> - 2026-07-09 20:58 -0500

csiph-web