Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2006-06-20 15:25:42


Paul A Bristow wrote:
>
>
> | -----Original Message-----
> | From: boost-bounces_at_[hidden]
> | [mailto:boost-bounces_at_[hidden]] On Behalf Of Eric Niebler
> |
> | Just to clarify, all Boost libraries aim for complete neutrality
> | regarding the min/max macros. They should compile cleanly
> | regardless of
> | whether the macros are defined or not, and should neither
> | cause them to
> | be defined (unless they must include system headers which
> | define them)
> | or undefine them.
> |
> | http://boost.org/more/lib_guide.htm
>
> Says:
>
> # If you want to call std::numeric_limits<int>::max(), use
> (std::numeric_limits<int>::max)() instead.
>
> # If you want to call a min() or max() member function, instead to doing
> obj.min(), use (obj.min)().
>
> Just to be clear, are you saying that these forms should ALWAYS be used in
> all code that might encounter windows.h or the min max macros (which
> obviously includes all Boost code)?
>
> This is a minor PITA, but we could get used to it :-(

That's exactly what I'm saying. Any time your fingers type "min" or
"max", you should ask yourself if the min/max macros will make a hash of
your code. If you forget, the Boost.Inspect tool, which is run by the
release manager, will remind you. It automatically checks for violations
of Boost's min/max guidelines.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk