Return-Path: X-Original-To: apmail-subversion-dev-archive@minotaur.apache.org Delivered-To: apmail-subversion-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4156C18C20 for ; Thu, 13 Aug 2015 23:25:28 +0000 (UTC) Received: (qmail 97159 invoked by uid 500); 13 Aug 2015 23:25:23 -0000 Delivered-To: apmail-subversion-dev-archive@subversion.apache.org Received: (qmail 97109 invoked by uid 500); 13 Aug 2015 23:25:23 -0000 Mailing-List: contact dev-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@subversion.apache.org Received: (qmail 97099 invoked by uid 99); 13 Aug 2015 23:25:22 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Aug 2015 23:25:22 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 4BB81C212E for ; Thu, 13 Aug 2015 23:25:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=daniel.shahaf.name header.b=YZn2g9HP; dkim=pass (1024-bit key) header.d=messagingengine.com header.b=H09iEeg3 Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 498xWuSmy8rc for ; Thu, 13 Aug 2015 23:25:21 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id D75AA20BFB for ; Thu, 13 Aug 2015 23:25:20 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id C279E22A7A; Thu, 13 Aug 2015 19:25:19 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Thu, 13 Aug 2015 19:25:19 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=WlSuTuZib4OrOu0z B+X/Fk+z4bg=; b=YZn2g9HPSDD58AkT9fjKqTKMGSWap60tykVh0/0tnVE5HzBe 6d4iQy6JvP5QVns0TNf5BS/xcO3zgA68ZSprbdyeFobQ5VsVts3mTC2QtuvFMy59 hy4fQYwuZJo0iV7UTOo/hri8ZB4CYfcJYRVo6KUJMBL3mWY0ZteFhy/YFqM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=WlSuTuZib4OrOu0 zB+X/Fk+z4bg=; b=H09iEeg3/jAxsPICE4QeDFCpaNrEWBnGd3Q8or5h6jAE6SA nl/KQJdQ+X7aHJRTH9YQUb7n9pmxJVS39RQJTY+cUnhZKCoNhxjwVNU29W1BGNLN XrlDhBQfjnGy25bwNZo9oHYYO+p9u+lA+4VofdXlY5puP+O70W6YldCzQwcA= X-Sasl-enc: TRoF9B4X11fruA9lI9lmAvjhHHJj5WIDziA6hzZPCU/h 1439508319 Received: from tarsus.local2 (bzq-109-67-5-172.red.bezeqint.net [109.67.5.172]) by mail.messagingengine.com (Postfix) with ESMTPA id 23DF468015A for ; Thu, 13 Aug 2015 19:25:18 -0400 (EDT) Date: Thu, 13 Aug 2015 23:25:17 +0000 From: Daniel Shahaf To: dev@subversion.apache.org Subject: Re: Review of sizeof usage Message-ID: <20150813232517.GH1998@tarsus.local2> References: <87pp2tvpfc.fsf@wandisco.com> <55CA5344.8090005@wandisco.com> <20150811223111.GH1859@tarsus.local2> <55CAFED5.4030109@wandisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <55CAFED5.4030109@wandisco.com> User-Agent: Mutt/1.5.21 (2010-09-15) Branko Čibej wrote on Wed, Aug 12, 2015 at 10:07:49 +0200: > On 12.08.2015 00:31, Daniel Shahaf wrote: > > > >>> We have had problems with both styles in the past, so neither is immune > >>> to bugs. I prefer the explicit type as it is easier to grep. > >> The explicit type form is more accident-prone than the variable form > >> because any change requires two modifications in the same statement > >> instead of one. > > Why doesn't the compiler or buildbot catch accidents? > > I can't imagine a way for the compiler to emit warnings for such > constructs without getting a far too large percentage of false > positives. It's perfectly valid, and in many cases required by some > object-like architecture, to allocate a buffer that has a different size > than the one implied by the pointer that stores the return value. This > is C, after all. > Okay, so from the compiler authors' perspective, "allocation size mismatches pointed-to-object size" warnings should not be on by default. Fair enough. But from our perspective as Subversion maintainers, we never *intentionally* allocate a buffer smaller than the pointed-to object, so the warnings would be useful to us. We should therefore opt-in to them. (via compiler flags, or have buildbot run static analysis, or…) Cheers, Daniel > -- Brane