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.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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 C5AA21F463 for ; Sun, 29 Dec 2019 09:19:32 +0000 (UTC) Received: from localhost ([::1]:50278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilUjT-0005z3-AF for normalperson@yhbt.net; Sun, 29 Dec 2019 04:19:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53678) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilUjO-0005yl-Io for bug-gnulib@gnu.org; Sun, 29 Dec 2019 04:19:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ilUjN-0004gN-12 for bug-gnulib@gnu.org; Sun, 29 Dec 2019 04:19:26 -0500 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::7]:24219) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ilUjM-0004Yw-CT for bug-gnulib@gnu.org; Sun, 29 Dec 2019 04:19:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1577611160; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=obhCrz+IMH2jY4PIGI0YmbyV0om1+BfnQqXIxPC8j0E=; b=HlHl0o+WvNBmScEgvO5EaZWBVxkmG4enzxTzXbSLpHLWa6wZZ0V7mUd2oV23DMCUIL anex7yiD7iQkyNBDdZwxG5U0GojtTeQva9vL4ewH0h6UX1dEKvCacb/KqpVP5CfbCt+U Iz71tipV3RWnrjPyoDyy+p5/QbjJYePfOg4qWEe7sjIwEdTMq0Du3pvgHDifhKnun5bG iHeBIVpLryHVDgJRM2VZXqx9332rAJ1Z3lSFMTN1lIP9RouYZg/Rdw5Is/shsaCEviMC PWEkDL2/1wdSU/Q10fuaQqPNYf7iR66unfE4kvgeQ7VpNBgwVAd/p44qxX73jyGfxrRh KqTw== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AXj0Jt0kPFIgK7tToaE=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 46.1.3 DYNA|AUTH) with ESMTPSA id R06a06vBT9J9AYq (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Sun, 29 Dec 2019 10:19:09 +0100 (CET) From: Bruno Haible To: ag Subject: Re: string types Date: Sun, 29 Dec 2019 10:19:07 +0100 Message-ID: <1726435.PWpjjHmTz1@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-170-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20191228131438.GA797@HATZ> References: <175192568.e2XXTFFdkW@omega> <2179574.G9OhZXe8sF@omega> <20191228131438.GA797@HATZ> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::7 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: , Cc: Tim =?ISO-8859-1?Q?R=FChsen?= , Paul Eggert , bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Aga wrote: > - the returned value of the *printf family of functions dictates their > limits/range, as they return an int, this can be as INT_MAX mostly Yes, we need new implementations of the *asprintf functions that are not limited to returning strings of maximum length INT_MAX. > - as since there is a "risk"=B9 that someone has to take at some point = (either the > programmer or the underlying library code (as strdup() does)), the de= signed > interface should lower those risks I agree with the goal. How to do it precisely, is an art however. > In the case of an error, returns > 0 which is either: > #define EDSTPAR -1 /* Error : bad dst parameters */ > #define ESRCPAR -2 /* Error : bad src parameters */ > #define EMODPAR -3 /* Error : bad mode parameter */ > #define ETRUNC -4 /* Error : not enough space to copy/concatenate > and truncation not allowed */ I don't think an interface for string concatenation with that many error cases will be successful. Programmers are lazy, therefore - some will not check the errors at all, - some will only check for the fourth one (because "I'm not passing inval= id arguments, after all"), - among those few that implement all 4 checks, half will get it wrong (that's my experience with similarly complex functions like mbrtowc() or iconv()). =46or an interface to be successful, it needs to be simpler than that. Bruno