From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cB8G3-00055Y-BF for qemu-devel@nongnu.org; Sun, 27 Nov 2016 17:49:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cB8G1-0004Rv-KV for qemu-devel@nongnu.org; Sun, 27 Nov 2016 17:49:15 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:26143) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cB8G1-0004PO-Bk for qemu-devel@nongnu.org; Sun, 27 Nov 2016 17:49:13 -0500 Date: Mon, 28 Nov 2016 00:49:00 +0200 From: Yuval Shaia Message-ID: <20161127224859.GA14196@yuval-lap> References: <1480069886-11703-1-git-send-email-yuval.shaia@oracle.com> <20161127141004.GL8854@var.home> <20161127221825.GA19258@yuval-lap> <20161127222041.GZ18656@var.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161127222041.GZ18656@var.home> Subject: Re: [Qemu-devel] [PATCH] cutils: Define min and max marcos List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Samuel Thibault Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, jan.kiszka@siemens.com On Sun, Nov 27, 2016 at 11:20:41PM +0100, Samuel Thibault wrote: > Yuval Shaia, on Mon 28 Nov 2016 00:18:26 +0200, wrote: > > On Sun, Nov 27, 2016 at 03:10:04PM +0100, Samuel Thibault wrote: > > > Yuval Shaia, on Fri 25 Nov 2016 12:31:26 +0200, wrote: > > > > -#ifndef _WIN32 > > > > -#define min(x,y) ((x) < (y) ? (x) : (y)) > > > > -#define max(x,y) ((x) > (y) ? (x) : (y)) > > > > -#endif > > > > > > This has protection against _WIN32, I guess that was on purpose. > > > > I'm not following. > > Are you suggesting that this was there to prevent code from compiling when > > _WIN32 was define? > > I mean that min and max are already defined on windows: > > https://msdn.microsoft.com/en-us/library/windows/desktop/dd757290%28v=vs.85%29.aspx > > > > Perhaps qemu should avoid risking a clash with OS-provided min/max > > > macros, by renaming these to qemu_min/max? > > > > On MIN and MAX? > > Yes. > > > I have noticed some other approach which was taken in osdep.h with ifdef, > > for example: > > 193 #ifndef ROUND_UP > > 194 #define ROUND_UP(n,d) (((n) + (d) - 1) & -(d)) > > 195 #endif > > That could probably be enough for our use indeed. Great. Can you take a look at my revised patch? {disas,slirp}: Replace min/max with MIN/MAX macros > > Samuel