Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2002-01-07 07:05:37


The following bug report came my way, however
the issue predates the new config, which just
copied what we had previously here.
Can anyone remember why we have the min/max
behaviour that we have with VC6?

- John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/

-------------Forwarded Message-----------------

From: INTERNET:noreply_at_[hidden], INTERNET:noreply_at_[hidden]
To: [unknown], INTERNET:noreply_at_[hidden]
        
Date: 06/01/02 13:58 PM

RE: [ boost-Bugs-495495 ] Visual C++ and min/max specialization

Bugs item #495495, was opened at 2001-12-20 09:11
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=107586&aid=495495&group_id=7586

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: John Maddock (johnmaddock)
Summary: Visual C++ and min/max specialization

Initial Comment:
Boost's default configuration for Visual C++ 6.0
exposes some problems with the Visual C++ compiler
when using min/max. (Boost version 1.26)

I had setup a header to expose min/max template
functions instead of using the min/max macros in
stdlib.h:

using std::min;
using std::max;

The same header included boost header
(boost/operatiors.hpp)

The problem: If I mixed types in the min/max call,
Visual C++ would always call the specialized min/max
function for the long type given in suffix.hpp.

E.g.

float y = min( (double)a, (float)b );
    //call boost's min(long,long)!!!!

I'm not sure why you have the specialization of
min/max for long types in suffix.hpp, but from my
perspective its more dangerous than it is useful.

Without this template specialization, at least the
compiler tells me that no version of min matches min
(double,float).

----------------------------------------------------------------------

>Comment By: Jens Maurer (jmaurer)
Date: 2002-01-06 05:57

Message:
Logged In: YES
user_id=53943

First, it's not a specialization, it's an overload.

It looks like some MSVC headers or program expect the
min/max macro behaviour, where you can mix types freely.

I agree it changes semantics silently. I've forwarded this
to John Maddock, our config guy.

----------------------------------------------------------------------

You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=107586&aid=495495&group_id=7586

----------------------- Internet Header --------------------------------
Sender: nobody_at_[hidden]
Received: from usw-sf-netmisc.sourceforge.net (usw-sf-sshgate.sourceforge.net [216.136.171.253])
        by siaag2aa.compuserve.com (8.9.3/8.9.3/SUN-1.12) with ESMTP id IAA15646
        for <John_Maddock_at_[hidden]>; Sun, 6 Jan 2002 08:57:57 -0500 (EST)
Received: from usw-sf-web1-b.sourceforge.net ([10.3.1.5] helo=usw-sf-web1.sourceforge.net)
        by usw-sf-netmisc.sourceforge.net with esmtp (Exim 3.22 #1 (Debian))
        id 16NDoB-0003Hx-00; Sun, 06 Jan 2002 05:57:55 -0800
Received: from nobody by usw-sf-web1.sourceforge.net with local (Exim 3.22 #1 (Debian))
        id 16NDoB-0000m3-00; Sun, 06 Jan 2002 05:57:55 -0800
To: noreply_at_[hidden]
From: noreply_at_[hidden]
Subject: [ boost-Bugs-495495 ] Visual C++ and min/max specialization
Message-Id: <E16NDoB-0000m3-00_at_[hidden]>
Sender: nobody <nobody_at_[hidden]>
Date: Sun, 06 Jan 2002 05:57:55 -0800


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