aboutsummaryrefslogtreecommitdiff
path: root/pipermail/nel/2000-November/000015.html
blob: 95f27a174aed74d02efe82e8cc4b2451cc089936 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [Nel] matrix.cpp std::min/max problems?</TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:bryce%40neptune.net">
   <LINK REL="Previous"  HREF="000013.html">
   <LINK REL="Next" HREF="000007.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[Nel] matrix.cpp std::min/max problems?</H1>
    <B>Bryce Harrington</B> 
    <A HREF="mailto:bryce%40neptune.net"
       TITLE="[Nel] matrix.cpp std::min/max problems?">bryce@neptune.net</A><BR>
    <I>Fri, 10 Nov 2000 03:43:08 -0800 (PST)</I>
    <P><UL>
        <LI> Previous message: <A HREF="000013.html">[Nel] matrix.cpp std::min/max problems?</A></li>
        <LI> Next message: <A HREF="000007.html">[Nel] How do i compile this beast? Empty FAQ...</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#15">[ date ]</a>
              <a href="thread.html#15">[ thread ]</a>
              <a href="subject.html#15">[ subject ]</a>
              <a href="author.html#15">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>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

On Fri, 10 Nov 2000, Vianney Lecroart wrote:

&gt;<i> &gt; The VC++/STL min/max problem is pretty well known, and is a result of a
</I>&gt;<i> &gt; very buggy STL implementation in VC++, and some lawsuits.
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; Simple answer:  Define NOMINMAX in your Build Settings
</I>&gt;<i> 
</I>&gt;<i> ok, this define disables the macro min &amp; max, it's same behavior as doing
</I>&gt;<i> #undef min #undef max
</I>&gt;<i> but I search min in the VC include directory and subdirectory and there s
</I>&gt;<i> *no* min
</I>&gt;<i> definition in the STL (no template min) so we have to define our own min &amp;
</I>&gt;<i> max
</I>&gt;<i> template function in our code... no very cool...
</I>
-- 
Bryce Harrington
bryce @ neptune.net


</pre>

<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI> Previous message: <A HREF="000013.html">[Nel] matrix.cpp std::min/max problems?</A></li>
	<LI> Next message: <A HREF="000007.html">[Nel] How do i compile this beast? Empty FAQ...</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#15">[ date ]</a>
              <a href="thread.html#15">[ thread ]</a>
              <a href="subject.html#15">[ subject ]</a>
              <a href="author.html#15">[ author ]</a>
         </LI>
       </UL>
</body></html>