From owner-svn-src-head@freebsd.org Fri May 27 07:53:35 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38E13B4C6C1; Fri, 27 May 2016 07:53:35 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ig0-f176.google.com (mail-ig0-f176.google.com [209.85.213.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0D9571764; Fri, 27 May 2016 07:53:34 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ig0-f176.google.com with SMTP id ct2so16102452igb.0; Fri, 27 May 2016 00:53:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc:content-transfer-encoding; bh=THfewhxTt/QuNlsgv4i80CWRWgm6TA9lZILtRYJCSTM=; b=in2qpeEoEegLtt2/Z4r0HF/TlJhDPhjwaDoTFiNHt7nhVAknbX9OSKEsWTk9P3QQ3Z jJkghXITqyYEY+Bn02RmZ2KOAOudvZSqDCRfkLsnKPzfe4REv3WMVZzcUUj6JUCugmNa blBs+h0ymXNqeVQt2XP2wZLUKS4or8XY9auFaCXc5g/LQ3og4y2v7WcbgMbvoH6h7ahb yil8edKRkNfeBtbExtfD117l8UxIvkJuk+EwYgQjTVI+2F41yFvtq/J6KQBqT4jFEPoj qLSm7A8XIlTraROhG+e1kHonCeUNzMeBOroEbI9k2ugf6jBAe7tWp1hSEBbfNpe5oevx xC7w== X-Gm-Message-State: ALyK8tINxrbqoWkxBDeCOmME38tfojYl71nOGIpqcouYZf0oPuCuuzfrfduMoya4Niawmg== X-Received: by 10.50.129.36 with SMTP id nt4mr6621943igb.23.1464331826270; Thu, 26 May 2016 23:50:26 -0700 (PDT) Received: from mail-ig0-f177.google.com (mail-ig0-f177.google.com. [209.85.213.177]) by smtp.gmail.com with ESMTPSA id o206sm2264274itg.9.2016.05.26.23.50.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 May 2016 23:50:26 -0700 (PDT) Received: by mail-ig0-f177.google.com with SMTP id ct2so15462074igb.0; Thu, 26 May 2016 23:50:25 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.183.195 with SMTP id eo3mr6978763igc.8.1464331825466; Thu, 26 May 2016 23:50:25 -0700 (PDT) Reply-To: cem@FreeBSD.org Received: by 10.36.205.70 with HTTP; Thu, 26 May 2016 23:50:25 -0700 (PDT) In-Reply-To: References: <201605270531.u4R5VE6R006890@repo.freebsd.org> Date: Thu, 26 May 2016 23:50:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r300824 - head/lib/libmd From: Conrad Meyer To: Ed Schouten Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2016 07:53:35 -0000 There's nothing to support =E2=80=94 literally ignoring the keyword is an acceptable implementation. So it's disappointing C++ chooses to reject C keywords. My take is that C++ programs shouldn't be including sys/md5.h directly at all. That's the kernel's header. If they want to use md5, they go through libmd like everyone else. So it doesn't matter too much to me whether the wrapping happens in libmd md5.h or sys/md5.h. If sys/md5.h includes a static inline function, there are bigger problems with potentially trying to interpret C code as C++. Frankly, C++ is not a C dialect anymore. They happen to share a bare bones assemblerish ABI but other than that they are diverging. Your proposed macro seems ok, although it is pretty long for where it would be used. Maybe __min_size()? Best, Conrad On Thu, May 26, 2016 at 11:35 PM, Ed Schouten wrote: > Hi Conrad, > > 2016-05-27 7:31 GMT+02:00 Conrad E. Meyer : >> libmd: Work around C++'s inability to understand C > > So C++ doesn't support using 'static' within array types, right? What > I personally dislike about this specific change: > > - Including directly still doesn't work. > - If is ever going to include a 'static inline' function, > the static keyword would also be stripped off. > > Would it make sense to come up with a macro in to deal with= this? > > #if defined(__cplusplus) || defined(ancient compiler) > #define __minimum_size(n) n > #else > #define __minimum_size(n) static (n) > #endif > > That way we can annotate this everwhere we'd want, without needing to > care about compiler versions, languages, etc. > > -- > Ed Schouten > Nuxi, 's-Hertogenbosch, the Netherlands > KvK-nr.: 62051717