Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-02-24 04:42:44

"Eric Niebler" <eric_at_[hidden]> writes:

> John Maddock wrote:
>> Would you like to make and manage the change? Remove the workarounds from
>> win32.hpp, and then patch all occurrences of min and max throughout boost?
>> John.
> <recap>
> We agreed to make boost work in the presence of the min/max macros by
> wrapping all min/max function identifiers in parens, like
> (std::min)(a,b);
> </recap>
> I have spent some time and made the 800 or so edits throughout boost
> required to make it play nice with the min/max macros. I'm running
> regressions now. I have a couple of questions about procedure before
> I can commit the changes.
> 1) Is this a good time?


> I know there's talk about a 1.31.1
> release. Will this be done from the 1.31.0 branch or from main?

>From the branch.

> I
> don't want to destabilize before a release.

Good thinking.

> 2) I can't test with old compilers, which are the ones most likely to
> have a hard time with this change.

They all compile and run the following:

  namespace std {
    template<class T> const T& min(const T& a, const T& b) { return a<b?a:b; }
  int main()
      int x = 0;
      int y = 1;
      return (std::min)(x,y);

But where will the definition of min come from on broken stdlib

> Also, I'm not a CVS guru. If all
> hell breaks loose as a result of this change, is there someone
> willing to help me back it out?

Just "cvs tag" to mark the state before you start making changes and
it'll be comparitively easy.

> 3) Is there a boost developer style guide where we can document the
> fact that all calls to min/max functions must be wrapped in parens?
> 4) This is the sort of thing developers will forget to do even if it's
> in a style guide. A simple way of ensuring this stays fixed would
> be to run the regressions with min() and max() #defined to garbage,
> so that violations are detected and corrected early. Is this
> possible?

Yes, it's possible, but that'll only detect the usage:


and not


both of which are going to be banned, right?

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at