From owner-freebsd-current@FreeBSD.ORG Sun Jul 29 20:27:20 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B15B9106566B; Sun, 29 Jul 2012 20:27:20 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 6D0C58FC16; Sun, 29 Jul 2012 20:27:19 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id F346D7300A; Sun, 29 Jul 2012 22:47:21 +0200 (CEST) Date: Sun, 29 Jul 2012 22:47:21 +0200 From: Luigi Rizzo To: Arnaud Lacombe Message-ID: <20120729204721.GA87481@onelab2.iet.unipi.it> References: <20120725155211.GA33971@onelab2.iet.unipi.it> <20120729095833.GB80946@onelab2.iet.unipi.it> <20120729191958.GB85015@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: "Bjoern A. Zeeb" , David Chisnall , current@freebsd.org Subject: Re: RFC: libkern version of inet_ntoa_r X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jul 2012 20:27:20 -0000 On Sun, Jul 29, 2012 at 03:38:59PM -0400, Arnaud Lacombe wrote: > Hi, > > On Sun, Jul 29, 2012 at 3:19 PM, Luigi Rizzo wrote: > > Remapping f(a) into f(a, b) requires both a macro > > and a wrapping function, something like this > > > > T __f(T1 a, T2 b) { return f(a, b); } > > #define f(a) __f(a, b) > > > This can be done way more easily: > > void fn(int a, int b) > { > printf("%d %d\n", a, b); > } > > #define fn(x) ({ fn(x, 42); }) nice trick, one always learns something on these lists... now i wonder how it works with MSVC (windows being one of the other platforms where i need to build the ipfw+dummynet code...) cheers luigi