From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.bugs Subject: bug#32252: [PATCH] %o and %x now format signed numbers Date: Tue, 24 Jul 2018 20:15:57 +0200 Message-ID: References: <7e8dd084-7ab9-c2ce-1d6c-e673fa998f11@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1532457250 18033 195.159.176.226 (24 Jul 2018 18:34:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 24 Jul 2018 18:34:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 32252@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 24 20:34:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fi28J-0004XU-VH for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Jul 2018 20:34:04 +0200 Original-Received: from localhost ([::1]:42065 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fi2AQ-0000mv-E7 for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Jul 2018 14:36:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fi1ru-0000On-Pn for bug-gnu-emacs@gnu.org; Tue, 24 Jul 2018 14:17:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fi1rq-0002T4-9Q for bug-gnu-emacs@gnu.org; Tue, 24 Jul 2018 14:17:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50725) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fi1rq-0002Sb-2L for bug-gnu-emacs@gnu.org; Tue, 24 Jul 2018 14:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fi1rp-0004l8-Mg for bug-gnu-emacs@gnu.org; Tue, 24 Jul 2018 14:17:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Helmut Eller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Jul 2018 18:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32252 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 32252-submit@debbugs.gnu.org id=B32252.153245616818233 (code B ref 32252); Tue, 24 Jul 2018 18:17:01 +0000 Original-Received: (at 32252) by debbugs.gnu.org; 24 Jul 2018 18:16:08 +0000 Original-Received: from localhost ([127.0.0.1]:55743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fi1qx-0004k0-ML for submit@debbugs.gnu.org; Tue, 24 Jul 2018 14:16:07 -0400 Original-Received: from mail-wm0-f49.google.com ([74.125.82.49]:50757) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fi1qv-0004jD-6K for 32252@debbugs.gnu.org; Tue, 24 Jul 2018 14:16:05 -0400 Original-Received: by mail-wm0-f49.google.com with SMTP id s12-v6so165383wmc.0 for <32252@debbugs.gnu.org>; Tue, 24 Jul 2018 11:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=nMH1EOIyHRZ7Y/zpHejANqTPV4EnHaoVNOy0VSRR5xA=; b=upw/rcxDmJ4V65a2l68Gcvg0ARRuOSpjn9q/n80XF8FYpdRJxkfm7u0+eM/Ep/Vh+G wHuC2BQ6ZZvKSF9oohwDQqk+Oz3XCT/U6vo1oVtQJAwvY3vZzojx0TLqjyOTQxnYWJaa 0XPED3fNVKomIzoleFds3DA5inAJk15/qy+xLJUX1Bm0IpOVUawWx1MeIH+BeG6IEf6B ajb0rBcUZzfhocqvOcJHC8vlau7DToo3qcY0Quu4xe27Jwc8mRo0ygVn3Y8CkPyt+fpX 4GecMVyK8FMAzY0tmovZoybbN0vmHCejKS1D67K8F1UymaAlJUkChlJZadh7y4BDktpP tzdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=nMH1EOIyHRZ7Y/zpHejANqTPV4EnHaoVNOy0VSRR5xA=; b=QgFQG0xg8kOann/Y8b/boRHfZYOaZM/9UyrLwliBnoTCzzaIgnylg38VIz4TM72/l6 SrqFdvq1/uEn/8Gf0U/KDL4Rbs5GMw5N4fURTgsTQNJZAZGTVzHEb8Nkh383ef8kub93 OafIixdzD9ADiwehzw1U0yAwr0IeItt4/RwrxTRkg8N1GwKJhLstvBilRAb8wDSaRbhw lDrzySgsZerKRV5v5feFP9QFibYFrIIJsfY0eU3vnOM6B3IlEG31uRJ0qGSPEt8HRzrN eeqmDOR3Hr9ylq4UKfFpo6XNeNiV1whDoP+vypdu0eKoElqf4HfO9HlYdkkqosDRyWIj 8aig== X-Gm-Message-State: AOUpUlGJTTSKyI6hDljChaWzrmKTZkikEq84uU4FQXkTulvIR+tzr54X /FLQ8AvR7rzpFttOnAEgILZsTzYL X-Google-Smtp-Source: AAOMgpcBgZw/7NNqu4mqyJ9e4VNrRP8HtCfFTtTacmh2sx/nFeVKvm0FVyYq1VrXiTbmRjPEd2ryZg== X-Received: by 2002:a1c:68f:: with SMTP id 137-v6mr2719987wmg.82.1532456159168; Tue, 24 Jul 2018 11:15:59 -0700 (PDT) Original-Received: from caladan ([37.186.181.82]) by smtp.gmail.com with ESMTPSA id y14-v6sm24354093wrq.45.2018.07.24.11.15.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Jul 2018 11:15:58 -0700 (PDT) In-Reply-To: <7e8dd084-7ab9-c2ce-1d6c-e673fa998f11@cs.ucla.edu> (Paul Eggert's message of "Tue, 24 Jul 2018 07:22:52 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:148898 Archived-At: On Tue, Jul 24 2018, Paul Eggert wrote: >> With your change %x will also have quite a different meaning in C11. > > Not really, as Emacs (format "%x" N) agrees with C11 printf ("%x", N) > in all values of N that are valid in both languages. In C11, negative > values are not valid, as printf ("%x", N) has undefined behavior when > N is negative. So we are discussing an area where Emacs Lisp can > define behavior without introducing incompatibilities with C11. In practice, printf ("%x", (int)N) prints the bits in N as unsigned integer not as signed integer. > If we changed (format "%x" -1) to signal an error instead, that would > also be upward-compatible with C11. However, it's more useful for > something like (format "#x%x" -1) to output a string that can 'read' > can scan to get -1, something that's not true of Emacs now. #x-1 maybe interesting to the read function but it's not interesting to humans. Humans want to see #x3fffffffffffffff. >>> This seems like overkill for such a small >>> change to functionality that hardly ever matters; plus, %x, %X and %o >>> would continue to have problematic machine-dependent semantics and >>> would not be sensibly extensible to bignums. >> >> If it doesn't matter to you then why make the change/break at all? > > It does matter to me, actually. If it matters to you then you should have no problem with introducing an new specifier for this. > I think Emacs should have sensible behavior even in corner cases that > hardly ever arise in real programs. That %x prints the two's complement representation for negative fixnums is fairly sensible behavior. Emacs should not change such basic things or for that matter start to print =E2=80=99 instead of '. Such changes wou= ld be the opposite of sensible. Helmut