unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Daniel Colascione <dancol@dancol.org>
Cc: Eli Zaretskii <eliz@gnu.org>, eggert@cs.ucla.edu, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] trunk r114593: * lisp.h (eassert): Don't use	'assume'.
Date: Fri, 11 Oct 2013 14:31:07 +0400	[thread overview]
Message-ID: <5257D36B.4090305@yandex.ru> (raw)
In-Reply-To: <5257CB20.4030809@dancol.org>

On 10/11/2013 01:55 PM, Daniel Colascione wrote:

> You could argue that having two macros instead of one imposes a maintenance burden
> and that there isn't a payoff sufficient to justify this burden, but I don't think
> the maintenance cost of having another macro is very large, especially if we leave
> existing assertions as they are and use the assume-and-assert macro only for cases
> that are clearly free of side effects.

May be I missed something, but could you please provide an example where
assume (...) really yields in better code?  As for the signed vs. (more
efficient) unsigned arithmetic, you can't turn:

int f (int x, int y, int z)
{
   return x / y + y / z + z / x;
}

into:

unsigned f (unsigned x, unsigned y, unsigned z)
{
   return x / y + y / z + z / x;
}

using assume(...), e.g.

int f (int x, int y, int z)
{
   assume (x >= 0);
   assume (y >= 0);
   assume (z >= 0);
   return x / y + y / z + z / x;
}

is just the same as in the first case.

Dmitry



  reply	other threads:[~2013-10-11 10:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1VTxwB-0001h8-7E@vcs.savannah.gnu.org>
2013-10-11  2:31 ` [Emacs-diffs] trunk r114593: * lisp.h (eassert): Don't use 'assume' Daniel Colascione
2013-10-11  6:36   ` Paul Eggert
2013-10-11  7:00     ` Eli Zaretskii
2013-10-11  7:41       ` Daniel Colascione
2013-10-11  8:08         ` Eli Zaretskii
2013-10-11  8:19           ` Daniel Colascione
2013-10-11  8:59             ` Stephen J. Turnbull
2013-10-11  9:10               ` Daniel Colascione
2013-10-11 10:27                 ` Stephen J. Turnbull
2013-10-11 12:42                   ` Stefan Monnier
2013-10-11 15:24                     ` Stephen J. Turnbull
2013-10-11  9:06             ` Eli Zaretskii
2013-10-11  9:18               ` Daniel Colascione
2013-10-11  9:36                 ` Eli Zaretskii
2013-10-11  9:55                   ` Daniel Colascione
2013-10-11 10:31                     ` Dmitry Antipov [this message]
2013-10-11 15:22                       ` Paul Eggert
2013-10-11 15:41                         ` Daniel Colascione
2013-10-12  7:37                           ` Paul Eggert
2013-10-11 11:19                     ` Eli Zaretskii
2013-10-11 15:57                       ` Daniel Colascione

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=5257D36B.4090305@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=dancol@dancol.org \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).