From owner-freebsd-current@FreeBSD.ORG Sun Jul 29 19:39:01 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 1BF20106566C; Sun, 29 Jul 2012 19:39:01 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 78BC38FC17; Sun, 29 Jul 2012 19:39:00 +0000 (UTC) Received: by wgbds11 with SMTP id ds11so4050328wgb.31 for ; Sun, 29 Jul 2012 12:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=B8xkzH7r9G1ebsxseCUNAtZuS+wHdNLIBf9GXkjSFA4=; b=MusjrRcEelDWs/EW1vls3xCCpp5pdQWdY62PJJdMCsSGwy8pzhNsvoCBR83TQl/4Bd b6c6LuVKWmBhzlVJoVRswMfh01TDvhC/ke58yTMQvqKoXUDqRpLFjqu3ZGeOgYsgcHz3 Bua7dTcbB3JozryW4iOLbhvPq6D7ZQI8kZcabjdUL95KrebqQMEJttA80P35a/xoxLVS ccZM0hBw0/Ubai2bdv5Ckze1tUpLcWPzh33BNu7WlDaO15d1nQLOHbheN4mKi160UC4D Ocg1x+bajxvXCHBuf4LENKPPjJIvf9gRFX3uiPI13jB5oOAfwD8bB5eoCAL7YT+hkVz8 lGqg== MIME-Version: 1.0 Received: by 10.180.85.167 with SMTP id i7mr10523585wiz.8.1343590739411; Sun, 29 Jul 2012 12:38:59 -0700 (PDT) Received: by 10.216.199.31 with HTTP; Sun, 29 Jul 2012 12:38:59 -0700 (PDT) In-Reply-To: <20120729191958.GB85015@onelab2.iet.unipi.it> References: <20120725155211.GA33971@onelab2.iet.unipi.it> <20120729095833.GB80946@onelab2.iet.unipi.it> <20120729191958.GB85015@onelab2.iet.unipi.it> Date: Sun, 29 Jul 2012 15:38:59 -0400 Message-ID: From: Arnaud Lacombe To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 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 19:39:01 -0000 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); }) int main(int argc, char **argv) { fn(0); return 0; } works just fine. > but i am not so interested in participating to the IOCCC :) > maybe you should ;-) - Arnaud ps: this construct is used all over the Linux kernel compatibility libraries.