The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: steffen@sdaoden.eu (Steffen Nurpmeso)
Subject: [TUHS] Unix stories
Date: Thu, 09 Feb 2017 18:15:59 +0100	[thread overview]
Message-ID: <20170209171559.K5qcB%steffen@sdaoden.eu> (raw)
In-Reply-To: <1486652148.1670510.875683520.3DDF9622@webmail.messagingengine.com>

Random832 <random832 at fastmail.com> wrote:
 |On Thu, Feb 9, 2017, at 08:46, Steffen Nurpmeso wrote:
 |> so now i really got this a few minute ago after adding negative
 |> history number support (to count from history top):
 |> 
 |>   tty.c: In function 'c_history':
 |>   tty.c:4157:13: warning: operation on 'entry' may be undefined
 |>   [-Wsequence-point]
 |>          entry = isneg ? --entry : (siz_t)a_tty.tg_hist_size - entry;
 |>          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 |> 
 |> And in my opinion this is just plain terrible?  I think it is
 ...
 |What's wrong with entry = isneg ? entry-1 : (siz_t)a_tty.tg_hist_size -
 |entry;

Another example:

  spam.c: In function '_spam_rate2score':
  spam.c:1137:38: warning: to be safe all intermediate pointers in cast from 'char **' to 'const char **' must be 'const' qualified [-Wcast-qual]
      ids = n_idec_ui32_cp(&m, buf, 10, (char const**)&buf);

To satisfy we need in fact a temporary variable, since you cannot
apply cast operators on non-lvalues:

  spam.c: In function '_spam_rate2score':
  spam.c:1137:38: error: lvalue required as unary '&' operand
      ids = n_idec_ui32_cp(&m, buf, 10, &(char const*)buf);

And yeah, you need to do something about:

  spam.c: In function '_spam_rate2score':
  spam.c:1137:38: warning: passing argument 6 of 'n_idec_buf' from incompatible pointer type [-Wincompatible-pointer-types]
      ids = n_idec_ui32_cp(&m, buf, 10, &buf);
                                        ^
  nailfuns.h:319:63: note: in definition of macro 'n_idec_ui32_cp'
      n_idec_buf(RP, CBP, UIZ_MAX, B, (n_IDEC_MODE_LIMIT_32BIT), CLP)
                                                                 ^~~
  nailfuns.h:303:22: note: expected 'const char **' but argument is of type 'char **'
   FL enum n_idec_state n_idec_buf(void *resp, char const *cbuf, uiz_t clen,

I would buy that the other way around, i.e., if "buf" would be
constant and the function expects something non-constant.

 |Same number of characters (two more if you put spaces around the minus
 |sign, but hardly a huge burden in any case).

Ok you're right, this special case is not a huge burden.
With a good font l-1-i may also be no problem, but could.  I mean,
some people even use garbage collectors because they are afraid of
memory holes and such, and then such l-1-i problems which are
known to outperform human visual capabilities except at eleven
thirty in the morning are good to go?  This!  Come on.

 |You're basically asking for the standard to carve out an exception for
 |the cases, and precisely only those cases, where the meaning can be seen
 |to be 100% unambiguous (i.e. that the two values being assigned to a
 |variable are provably the same value, and there are no other reads) -
 |which would limit it exclusively to the prefix operator (and assignment
 |operators, I suppose, "x = x += 1" is as unambiguous as it is
 |pointless), and only when there is no other expression involved except
 |for the conditionals (you couldn't have "--entry + x", for example).

Oh yes, i do.  To me the above basically looks like
a reassignment, a creation of a completely new variable.  The
value is assigned after it has been computed.  The compiler may be
clever enough to realize that in certain cases this can end up as
something like "inc eax" or the like.
But all this surely off-topic.

--steffen


  reply	other threads:[~2017-02-09 17:15 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-01  5:00 Larry McVoy
2017-01-01  6:48 ` Nick Downing
2017-01-02  2:03   ` Steve Johnson
2017-01-02  2:42     ` Nick Downing
2017-01-02  6:01       ` Steve Nickolas
2017-01-02  6:21         ` Warren Toomey
2017-01-02  6:25         ` Nick Downing
2017-01-04  4:07           ` Steve Nickolas
2017-01-02  7:29       ` arnold
2017-01-02 22:52     ` Dave Horsfall
2017-01-02 22:56       ` Larry McVoy
2017-01-02 22:59         ` Ronald Natalie
2017-01-02 22:58       ` Ronald Natalie
2017-01-02 23:23     ` Tim Bradshaw
2017-01-03  0:49       ` Larry McVoy
2017-01-03 11:36         ` Joerg Schilling
2017-01-04 13:04         ` Steffen Nurpmeso
2017-01-04 14:07           ` Random832
2017-01-04 14:54             ` Ron Natalie
2017-01-04 15:59               ` Random832
2017-01-04 16:30                 ` Steffen Nurpmeso
2017-01-04 16:32                   ` Random832
2017-01-04 16:51                     ` Steffen Nurpmeso
2017-01-04 16:54                       ` Random832
2017-01-04 16:58                         ` Ron Natalie
2017-01-04 17:38                           ` Steffen Nurpmeso
2017-01-04 17:47                             ` Steffen Nurpmeso
2017-01-04 18:51                           ` Steve Johnson
2017-01-04 17:08                         ` Steffen Nurpmeso
2017-01-04 16:22             ` Steffen Nurpmeso
2017-01-04 16:35               ` Random832
2017-01-04 17:03                 ` Steffen Nurpmeso
2017-02-09 13:46                 ` Steffen Nurpmeso
2017-02-09 14:55                   ` Random832
2017-02-09 17:15                     ` Steffen Nurpmeso [this message]
2017-01-01 13:11 ` Ron Natalie
2017-01-01 16:50 Noel Chiappa
2017-01-01 21:45 ` Nemo
2017-01-02  2:53   ` Wesley Parish
2017-01-02 14:30 Doug McIlroy
2017-01-02 18:36 ` Dan Cross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170209171559.K5qcB%steffen@sdaoden.eu \
    --to=steffen@sdaoden.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).