[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] cutils: Define min and max marcos
From: |
Yuval Shaia |
Subject: |
Re: [Qemu-devel] [PATCH] cutils: Define min and max marcos |
Date: |
Mon, 28 Nov 2016 00:49:00 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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