From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 159581F8C6 for ; Mon, 30 Aug 2021 14:12:44 +0000 (UTC) Received: from localhost ([::1]:36106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKi1i-00077Y-56 for normalperson@yhbt.net; Mon, 30 Aug 2021 10:12:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKi1a-00075w-BI for bug-gnulib@gnu.org; Mon, 30 Aug 2021 10:12:34 -0400 Received: from uggla.sjd.se ([2001:9b1:8633::107]:53424) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKi1U-0006k6-J6 for bug-gnulib@gnu.org; Mon, 30 Aug 2021 10:12:34 -0400 DKIM-Signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=josefsson.org; s=ed2101; h=Content-Type:MIME-Version:Message-ID:In-Reply-To :Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding :Content-ID:Content-Description; bh=bH91Jks0FecPu3bEV1XzYx/5v1ZhCC201GGR6NbGruE=; t=1630332745; x=1631542345; b=qUK3iucE+hZ2JcWfOJQFOlTSIXImpa1/est2Vud+YWdDxoT+T/MhvKFm6J3Ntz33E77ei5hrMb mbP0SyVOjdBA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=josefsson.org; s=rsa2101; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bH91Jks0FecPu3bEV1XzYx/5v1ZhCC201GGR6NbGruE=; t=1630332745; x=1631542345; b=jNW0Mv9RalDNtnDKy4r46LTOG/o2UptKA6ae/erFQBZCUmINttsbm05Rknh0MP4atrAPyP0WkR afFpe4CmcqRCsAaPA9niPWq6jE567KjR81DL/dMIM0UrgWcvVPkX0+GYRXXnYk6407+Joc/LcW480 EThLiJnKKE0GyjQWX9Anvt9YIcFKaYKnr5vVrnJ8KfaN6OFqtOMynsbUMLq1Odr+JCvuQhJAF+knJ 4l4Nsvumv+v75W8NjN1l/3B5CGmXnqFmXoK6YJQgWpY8x6piO/ZapRRa0JIAhHmHlNjYf0DfHXI+l pKM8zz5XqeoAyNN+OQIY+/FdVBQ77dePcVaU5zxxymfqoAmF3X/sB1dAqtFZNPcVdcNpJnXrrm5Hk iuXVJGMfNBcQDGt5gwvz2KAikc9v/pw0pJtqVAI9qgcpQWFKbwNwC8JmEMk0d2Vqev2sYeXuPh ; Received: from [2001:9b1:41ac:ff00:4655:f58b:cb91:c5b0] (port=51462 helo=latte) by uggla.sjd.se with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKi1N-0002nK-1s; Mon, 30 Aug 2021 14:12:21 +0000 To: Bruno Haible Cc: Paul Eggert , bug-gnulib@gnu.org Subject: Re: [PATCH] base32, base64: prefer signed to unsigned integers References: <20210827222756.530247-1-eggert@cs.ucla.edu> <87tuj8pspu.fsf@latte.josefsson.org> <4787795.FjKLVJYuhi@omega> OpenPGP: id=B1D2BD1375BECB784CF4F8C4D73CF638C53C06BE; url=https://josefsson.org/key-20190320.txt X-Hashcash: 1:22:210830:eggert@cs.ucla.edu::fRI2NxYZCYm/BmZj:4ZxY X-Hashcash: 1:22:210830:bruno@clisp.org::KbE17khfI5hzw6uv:6BMw X-Hashcash: 1:22:210830:bug-gnulib@gnu.org::abUyscUCHtAVjICU:F3gL Date: Mon, 30 Aug 2021 16:12:20 +0200 In-Reply-To: <4787795.FjKLVJYuhi@omega> (Bruno Haible's message of "Sun, 29 Aug 2021 11:56:56 +0200") Message-ID: <877dg3nhrv.fsf@latte.josefsson.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=2001:9b1:8633::107; envelope-from=simon@josefsson.org; helo=uggla.sjd.se X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Reply-to: Simon Josefsson From: Simon Josefsson via Gnulib discussion list --=-=-= Content-Type: text/plain Bruno Haible writes: > Hi Simon, > >> I'm not sure I understand why idx_t is better than size_t >> here, can you elaborate? Why not ssize_t? > > You find a detailed explanation in the comments of idx.h. Thanks for the pointer -- it doesn't say anything about why ssize_t can't be used though? As a signed variant of size_t, it seems relevant to consider. >> Maybe a compromise is to >> keep the old API but add new APIs with idx_t types and the >> implementation of the old functions uses the new one. > > The objective is to eliminate bugs due to the use of unsigned types > for numerical values. Is that a realistic goal with C using the unsigned type size_t for low-level functions like strlen()? It seems like an un-idiomatic goal. > We can achieve it only by increasing the use of signed types such as > 'idx_t'. If we keep the old function, it needs to be marked with > __attribute__ ((__deprecated__)), otherwise existing code will > continue to use the old function forever. My idea was that both APIs would be supported indefinitely. /Simon --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIoEARYIADIWIQSjzJyHC50xCrrUzy9RcisI/kdFogUCYSznRBQcc2ltb25Aam9z ZWZzc29uLm9yZwAKCRBRcisI/kdFojHnAP4kvOrK+3kiqydi78B1NVJzsG4HG3zN C290ZZjS72mTMAD/Zab4I4KUxJcRH0g7kabYOWoCKo6Xu6zZHlgJ2J50xAk= =orGo -----END PGP SIGNATURE----- --=-=-=--