From owner-svn-src-projects@freebsd.org Mon May 20 22:23:51 2019 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B75A51594A6D for ; Mon, 20 May 2019 22:23:51 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it1-f179.google.com (mail-it1-f179.google.com [209.85.166.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 52C3995E9A; Mon, 20 May 2019 22:23:51 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it1-f179.google.com with SMTP id e184so1618871ite.1; Mon, 20 May 2019 15:23:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=y2I1Fg8E/sysHiSQxWycNFoYkCXQLmUICxjxmq/c6qU=; b=RqLf78XD3O++1GwM4bE6VXIjapja0sbvPbGxQSbs3460G3CRHA1YqatE1NNVMUnRAt T/zi4h/iMb6W6q6sdeah6GfvNaS37Vcgg4ucuuIoMTkLc3Fq5E7Uf2Uwh0Yr663mK+Co BS6bBaZ51AzNY7JKS1z6Akq6XGieFPDZXbS2I0Q5iPzOfiKA5rubPHNvb8pCURvmKmKt BV9jpQL8e9CF3s+5ZY0hFPDJBb0vxhQ/CItIi0IDqL0ZyQGcpugs/e8bOMEo1F4fUUJp Flw5v08epkra6a3LER6u4nk6kFYXUVQnG0CkAZIXEEuWDP532cZx4S7mye8zXPeczGOo Qp6g== X-Gm-Message-State: APjAAAWZuHG+mZyfOnGtL5zrgrVDHJc/Xa9kY53+Podu7DP3pzx/tyrc gqYsjmgPwdLrag3fFnUn4AhQgeja X-Google-Smtp-Source: APXvYqyfQ67RhIoanNH+zDIBDxRX1xSmjFogSE5//mt+yLwEZgek24shXWzVpcq06lQnhIibN7zK+Q== X-Received: by 2002:a02:b38e:: with SMTP id p14mr3691904jan.43.1558390637104; Mon, 20 May 2019 15:17:17 -0700 (PDT) Received: from mail-it1-f169.google.com (mail-it1-f169.google.com. [209.85.166.169]) by smtp.gmail.com with ESMTPSA id s10sm5955196iob.29.2019.05.20.15.17.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 15:17:16 -0700 (PDT) Received: by mail-it1-f169.google.com with SMTP id m140so1587707itg.2; Mon, 20 May 2019 15:17:16 -0700 (PDT) X-Received: by 2002:a02:5502:: with SMTP id e2mr5281987jab.87.1558390636563; Mon, 20 May 2019 15:17:16 -0700 (PDT) MIME-Version: 1.0 References: <201905201936.x4KJaaIC023310@repo.freebsd.org> <20190520202210.GT2748@kib.kiev.ua> <20190520205057.GU2748@kib.kiev.ua> In-Reply-To: <20190520205057.GU2748@kib.kiev.ua> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Mon, 20 May 2019 15:17:05 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r348007 - projects/fuse2/lib/libc/gen To: Konstantin Belousov Cc: Alan Somers , src-committers , svn-src-projects@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 52C3995E9A X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 22:23:51 -0000 On Mon, May 20, 2019 at 1:51 PM Konstantin Belousov wrote: > > On Mon, May 20, 2019 at 02:43:36PM -0600, Alan Somers wrote: > > True, but I though that strlen would be more readable. Clang is smart > > enough to realize that strlen's argument is a constant and omit the > > call to strlen, so that's what I went with. Is there any other reason > > to prefer sizeof() - 1 ? > > The reason is that it would also work for not so smart compiler, or with > a smart compiler after we finally turn on -ffreestanding for libc, as it > ought to be. If we did that, it might make sense to implement strlen() as a macro that did essentially the same thing using __builtin_strlen() (and __builtin_constant_p, if necessary) extensions. Best, Conrad