Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[OWBugzilla] [Bug 998] including <windows.h> and <vector> cause compiler exception during compilation

0 views
Skip to first unread message

bugzill...@www.openwatcom.org

unread,
Jul 6, 2010, 1:28:38 PM7/6/10
to openwatco...@openwatcom.org
http://bugzilla.openwatcom.org/show_bug.cgi?id=998

------- Comment #1 from pspe...@earthlink.net 2010-07-06 10:28 PST8PDT -------
Four years ago I implemented use of the NOMINMAX macro in win16.h (winnt.h
already used it) to allow the code to compile.

I don't believe the compiler blew up at that time, however; that part is new
and, when confirmed, a problem to be fixed.

As far as the code goes, it would be best to #define NOMINMAX before including
<windows.h> if you are also including any C++ header that relies on or defines
the min() and max() functions/function templates. If you don't then the macro
will be applied and, even if the compiler doesn't gp fault, the result will
still not be satisfactory.

I haven't actually tested this, although I did confirm that the OW 1.9 win16.h
does, in fact, use NOMINMAX properly.


--
Configure bugmail: http://bugzilla.openwatcom.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

bugzill...@www.openwatcom.org

unread,
Jul 6, 2010, 4:17:21 PM7/6/10
to openwatco...@openwatcom.org
http://bugzilla.openwatcom.org/show_bug.cgi?id=998

------- Comment #2 from leonid....@atisgroup.ru 2010-07-06 13:17 PST8PDT -------
This issue appears to be 100% reproducible. I’ve just performed “clean”
experiment: installed Windows XP, installed OW 1.9, and tried to compile same
piece of code. It yields the same result: exception.

bugzill...@www.openwatcom.org

unread,
Mar 5, 2015, 7:26:44 AM3/5/15
to openwatco...@openwatcom.org
http://bugzilla.openwatcom.org/show_bug.cgi?id=998





------- Comment #4 from Ernest-t...@klm.com 2015-03-05 04:26 PST8PDT -------

// This is the essence of the include windows.h and vector
// compile this file with wcl386.exe version 1.9
// access violation...

#define min( p1, p2 ) (((p1) < (p2)) ? (p1) : (p2))


template< class Type >
class numeric_limits {
public:
static Type min();
};

template< >
class numeric_limits< bool > {
public:
static bool min() { return( 0 ); }
};

bugzill...@www.openwatcom.org

unread,
Mar 5, 2015, 7:50:58 AM3/5/15
to openwatco...@openwatcom.org
http://bugzilla.openwatcom.org/show_bug.cgi?id=998





------- Comment #5 from Ernest-t...@klm.com 2015-03-05 04:50 PST8PDT -------
Created an attachment (id=179)
--> (http://bugzilla.openwatcom.org/attachment.cgi?id=179&action=view)
essence of include <windows.h> followed by <vector>

This is the essence of the #include <windows.h> followed by #include <vector>
compile this with wcl386.exe or wpp386.exe

note: both the public: and static can be removed and
still the crash occurs.
0 new messages