Subject: [Nel] matrix.cpp std::min/max problems?

From: Cary Farrier <[email-masked]>
Date: Thu, 09 Nov 2000 10:50:21 -0800

I just updated from the latest CVS snapshot, added r:\code\net\include
to the project settings, however when compiling matrix.cpp in VC++ 6.0
(SP3) the compiler is complaining that 'max is not a member of std'.

Any thoughts?

-> Cary
--

Cary Farrier    
Farrier Software, Inc.                        (303) 875-9148 fax/message
[email-masked]                        <http://www.farriersoft.com>

---

From: Vincent Archer <[email-masked]>
Date: Fri, 10 Nov 2000 09:32:47 +0100

> (SP3) the compiler is complaining that 'max is not a member of std'.

Note that, strictly speaking, bug reports should go thru the web
interface rather than the mailing list. It's a lot easier to manage
there. Use the mailing list if you can't access the WWW at all
for some reason (like being buried deep behind 4 firewalls that require
you to sign in blood to access the outside world).

Bug reported to the developper in charge.
-- 
Vincent Archer                                         Email: [email-masked]

Nevrax France.                              Off on the yellow brick road we go!

---

From: Bryce Harrington <[email-masked]>
Date: Fri, 10 Nov 2000 02:22:23 -0800 (PST)

Hi Cary, 

The VC++/STL min/max problem is pretty well known, and is a result of a
very buggy STL implementation in VC++, and some lawsuits. 

Simple answer:  Define NOMINMAX in your Build Settings

Longer answer:  
http://www.isis.ecs.soton.ac.uk/share/problems/fuzzyClouds/NetMet/netmet/docs/stlhelp.txt

The STL that ships with Visual C++ was developed by Dinkumware, rather
than by Microsoft.  Detailed errata is available here:
    http://www.dinkumware.com/

Bryce

-- 
Bryce Harrington
bryce @ neptune.net

---

From: "Vianney Lecroart" <[email-masked]>
Date: Fri, 10 Nov 2000 11:43:48 +0100

> Simple answer:  Define NOMINMAX in your Build Settings

ok, this define disables the macro min & max, it's same behavior as doing
#undef min #undef max
but I search min in the VC include directory and subdirectory and there s
*no* min
definition in the STL (no template min) so we have to define our own min &
max
template function in our code... no very cool...

> Longer answer:
http://www.isis.ecs.soton.ac.uk/share/problems/fuzzyClouds/NetMet/netmet/doc
s/stlhelp.txt
> _______________________________________________
> Nel mailing list
> [email-masked]
> /mailman/listinfo.cgi/nel

---

From: Bryce Harrington <[email-masked]>
Date: Fri, 10 Nov 2000 03:43:08 -0800 (PST)

Heh, well sorry but that's MS for ya...  

As I recall, if you go MFC-free this particular issue will vanish.
However there are other insidious STL bugs with Visual C++.

If in fact you are using MFC, I would urge you to cease doing so at the
earliest convenience.  Not only for portability reasons (MFC *ain't*
portable, especially not backwards-wise) but also because it is a poor
architecture for GUI development, and is not really in the GPL spirit of
things.  If you intend to conduct your development openly as a net
project, then crossplatformness is going to be especially treasured by
you.  There are many options for crossplatform GUI libs.  Let me know if
you'd like to discuss this more.  My two preferred libs are wxWindows
(good for OS-matching widgets for editors and similar), or libuta (SDL
compatible and skinnable).  Mozilla has another cross platform GUI lib
but I've not used it in its current incarnation so don't know whether
it's usable independently of Mozilla.

FWIW, I always stick this boilerplate code in any file that uses STL
that I'd like to compile with MSVC 4.2:

#ifdef _MSC_VER
// Fix broken STL implementation in MSVC 4.2
// Include files (for MSVC)
#pragma warning(disable: 4786)  // Kludge to get around bug in MSVC 4.2
#pragma warning(disable: 4788)  // See above
#endif

I think you may be stuck including your own max/min template functions.
That's a pretty minor thing compared with some of the patches you may
have to make to work around some of the other issues (especially if you
want to support pre-6.0 MSVC).  

Ultimately, you're going to want to trim down use of STL anyway, so you
can recover the performance loss.  We still use STL at WorldForge, for
instance, but some simple tests show that hand coded, non-templated map
and list classes provide some modest performance gains, and some day
when we're down to squeezing out the last bits of performance, we'll
probably be pulling STL out ourselves.

Bryce

-- 
Bryce Harrington
bryce @ neptune.net