Date: Thu, 26 May 2016 23:50:25 -0700 From: Conrad Meyer <cem@FreeBSD.org> To: Ed Schouten <ed@nuxi.nl> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300824 - head/lib/libmd Message-ID: <CAG6CVpXZXmw4j1s0dvsZi7jhy-XdfA8uk3ioQP2E4=TvE_DmBQ@mail.gmail.com> In-Reply-To: <CABh_MKnyrLOjSOdmeZn=6uVmV73fM4XXo1bXnOpja7K7UvzpCw@mail.gmail.com> References: <201605270531.u4R5VE6R006890@repo.freebsd.org> <CABh_MKnyrLOjSOdmeZn=6uVmV73fM4XXo1bXnOpja7K7UvzpCw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <ed@nuxi.nl> wrote: > Hi Conrad, > > 2016-05-27 7:31 GMT+02:00 Conrad E. Meyer <cem@freebsd.org>: >> 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 <sys/md5.h> directly still doesn't work. > - If <sys/md5.h> 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 <sys/cdefs.h> 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 <ed@nuxi.nl> > Nuxi, 's-Hertogenbosch, the Netherlands > KvK-nr.: 62051717
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpXZXmw4j1s0dvsZi7jhy-XdfA8uk3ioQP2E4=TvE_DmBQ>