From: Paul A Bristow (pbristow_at_[hidden])
Date: 2006-06-24 09:33:35
A further quick question on this problem.
It is my custom (having a strong view that it aids readers - including me -
of my programs) to write
How do I avoid min/max macro problems when writing, for example,
return numeric_limits<double>::max(); ?
Or have I done it already?
--- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow_at_[hidden] | -----Original Message----- | From: boost-bounces_at_[hidden] | [mailto:boost-bounces_at_[hidden]] On Behalf Of Eric Niebler | Sent: 20 June 2006 20:26 | To: boost_at_[hidden] | Subject: Re: [boost] [test] test/included min max macro issue | | | 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 | _______________________________________________ | Unsubscribe & other changes: | http://lists.boost.org/mailman/listinfo.cgi/boost |
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk