Hi Arthur,

Won't #undef max after including any MySQL header work as well?

Technically, the warning could be removed and max would be #undef quietly
and the defined as you suggest, but this is a design change so I refer this
to Howard.

Yaron



2013/11/16 Arthur O'Dwyer <[email protected]>

> On Fri, Nov 15, 2013 at 3:41 PM, Yaron Keren <[email protected]>
> wrote:
> >
> > -_LIBCPP_WARNING("macro min is incompatible with C++.  #undefing min")
> > +_LIBCPP_WARNING("macro min is incompatible with C++.  Try #define
> NOMINMAX "
> > +                "before any Windows header. #undefing min")
>
> Incidentally, this warning has annoyed me in the past when compiling
> MySQL 5.5 as C++. They have some code (in the name of portability, I'm
> sure) equivalent to
>
>     #ifndef max
>      #define min(a,b) (a < b ? a : b)
>      #define max(a,b) (a > b ? a : b)
>     #endif
>
> which I try to disable by putting
>
>     #define max max
>
> in another header. By #undef'ing max, libc++ interferes with this
> tactic — or rather, it's hard to tell for any given translation unit
> whether it interferes with it or not (depending on the order of
> #includes), which is even more distracting. I wonder whether it would
> be possible for the libc++ header to use
>
>     #undef max
>     #define max max
>
> instead of just "#undef max", or if the Standard prohibits that somehow.
>
> Not that I expect a change to happen, but I figured I should publicly
> register my particular use-case.
>
> –Arthur
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to