This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Deprecating min/max extension in C++


"Giovanni Bajo" <rasky@develer.com> writes:

| Gabriel Dos Reis <gdr@integrable-solutions.net> 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.
| >
| > That is a rather weak argument.  What is the type of the argument if
| > it were possible?
| 
| "float" of course, like we do for 3 + 4.0f.
| 
| > If float, why can't you write 3f?  If int, why can't
| > you write 4?
| 
| Because the example was just an example. In real code, "3" is probably a
| variable of integer type, and "4.0f" is probably a variable of floating
| point type.

Which we have not seen yet, for the purpose of assessing the purpoted
usefulness in real codes.  Arguments are easily made with xyz examples.

| Going on this way, why don't we to propose to deprecate "+" in C++ because
| std::plus can be used as a replacement?

  (1) If you think that has any useful purpose, I certainly won't stand
      in your way.

  (2) you're comparing apples-to-oranges, and you do know that.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]