From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6301 Path: news.gmane.org!not-for-mail From: Sergey Dmitrouk Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Convert some is* macros to inline functions Date: Mon, 13 Oct 2014 21:00:56 +0300 Message-ID: <20141013180056.GA28588@zx-spectrum.accesssoftek.com> References: <20141013142020.GA26828@zx-spectrum.accesssoftek.com> <1413210914.4885.1174.camel@eris.loria.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1413223282 20949 80.91.229.3 (13 Oct 2014 18:01:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Oct 2014 18:01:22 +0000 (UTC) To: "musl@lists.openwall.com" Original-X-From: musl-return-6314-gllmg-musl=m.gmane.org@lists.openwall.com Mon Oct 13 20:01:15 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Xdjvi-00059k-Ud for gllmg-musl@plane.gmane.org; Mon, 13 Oct 2014 20:01:11 +0200 Original-Received: (qmail 8049 invoked by uid 550); 13 Oct 2014 18:01:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 8037 invoked from network); 13 Oct 2014 18:01:09 -0000 Content-Disposition: inline In-Reply-To: <1413210914.4885.1174.camel@eris.loria.fr> Xref: news.gmane.org gmane.linux.lib.musl.general:6301 Archived-At: On Mon, Oct 13, 2014 at 07:35:14AM -0700, Jens Gustedt wrote: > Am Montag, den 13.10.2014, 17:20 +0300 schrieb Sergey Dmitrouk: > In section 7.1.4 the C standard explicitly says: > > > Any function declared in a header may be additionally implemented > > as a function-like macro defined in the header, ... Didn't look there, you're right. I was checking description of headers instead. > > Please find the attached patch that proposes replacing these macros > > with inline functions. > > I don't think that this is necessary. > > They only advantage of inline functions, here would be that the > conversion of the arguments would be done with implicit conversions > instead of casts. (For the macros this could be achieved by using > compound literals instead of casts, but well...) It's not necessary for C (as I know now), but it's required by ะก++ standard in 17.6.1.2: > Names that are defined as functions in C shall be defined as functions > in the C++ standard library. 175) > 175) This disallows the practice, allowed in C, of providing a masking > macro in addition to the function prototype. The only way to achieve > equivalent inline behavior in C++ is to provide a definition as an > extern inline function. Current headers do not conform to C++ when included as , and that's what I'm trying to fix. Would you consider a version that uses inline functions only when __cplusplus is defined? There is already 'extern "C"', so I guess it makes sense. Regards, Sergey