On Tue, Mar 08, 2005 at 02:06:48PM +0100, Giovanni Bajo wrote:
> Mark Mitchell <[EMAIL PROTECTED]> wrote:
>
> > IMO, if these are C++-only, it's relatively easy to deprecate these
> > extension -- but I'd like to hear from Jason and Nathan, and also the
> > user community before we do that. Of all the extensions we've had, this
> > one really hasn't been that problematic.
>
> I would prefer them to stay. My reasons:
>
> 1) std::min() and std::max() are not exact replacements. For instance, you
> cannot do std::min(3, 4.0f) because the arguments are of different type.
> Also, you cannot use reference to non-const types as arguments. The min/max
> exensions do not suffer from these problems (I consider the former very
> problematic, and the latter just annoying).
I was about to reply making the same point about template argument
deduction.
Whether or not the extensions get deprecated, shouldn't the docs for
them at least mention std::min and std::max, rather than only referring
to the infamous, flawed macros?
* gcc/doc/extend.texi: Mention std::min and std::max in docs for
min/max operators.
Patch OK for mainline?
jon
--
"In theory, practice and theory are the same,
but in practice they are different."
- Larry McVoy
Index: gcc/doc/extend.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/extend.texi,v
retrieving revision 1.241
diff -u -p -b -B -r1.241 extend.texi
--- gcc/doc/extend.texi 25 Feb 2005 18:29:28 -0000 1.241
+++ gcc/doc/extend.texi 8 Mar 2005 13:00:45 -0000
@@ -9157,6 +9157,10 @@ Since @code{<?} and @code{>?} are built
handle expressions with side-effects; @[EMAIL PROTECTED] min = i++ <? j++;}}
works correctly.
+The function templates @code{std::min()} and @code{std::max()} (declared
+in @code{<algorithm>}) also correctly handle expressions with side-effects
+e.g. @[EMAIL PROTECTED] min = std::min(i++, j++);}}
+
@node Volatiles
@section When is a Volatile Object Accessed?
@cindex accessing volatiles