2008-08-01  Travis Vitek  <vitek@roguewave.com>

	Merge r666742, r666829, r668632, r673164, r673573, r673978, r674008,
	r674023, r674069, r674236, r674441, r674550, r675269, r675315, r676077,
	r677756, r677764, r677770, r677777, r677789, r677783, r677791, r677800,
	r677810, r678003, r678239, r678483, r678619, r678905, r679241, r679246,
	r679601, r680049, r680050, r680051, r680545, r680756, r680775, r680791,
	r681102 from branches/4.2.x:


	2008-06-11  Eric Lemings <eric.lemings@roguewave.com>

	STDCXX-871
	* tests/include/rw_driver.h (rw_fatal):
	* tests/include/rw_printf.h (rw_sprintfa, rw_snprintfa): Add
	link to page containing specifications for formatting directives.
	* tests/include/rw_printf.h (rw_asnprintf): Removed old list of
	formatting directives.  Added more specifications for formatting
	directives to rwtest-fmtspec page and listed undocumented (i.e.
	complicated) formatting directives in a separate section so all
	directives are at least accounted for.


	2008-06-11  Eric Lemings <eric.lemings@roguewave.com>

	STDCXX-488
	* etc/config/gcc.config: Use rpath on Darwin 9 OR LATER VERSION.
	Do not use rpath on Darwin 8.


	2008-06-17  Farid Zaripov  <farid_zaripov@epam.com>

	* GNUmakefile: Add "narrow" mode to the build mode in 15d builds.


	2008-07-01  Travis Vitek  <vitek@roguewave.com>

	STDCXX-670
	* include/ansi/setjmp.h [!setjmp]: Define function macro setjmp.


	2008-07-02  Martin Sebor  <sebor@roguewave.com>

	STDCXX-986
	* doc/stdlibug/2-3.html (2.3.1 Input Stream Iterators): Corrected
	a typo in example code.


	2008-07-04  Farid Zaripov  <faridz@apache.com>

	* etc/config/makefile.rules: Define local shell variable
	TZ to export its value (to complete changes in rev. 561060).


	2008-07-04  Farid Zaripov  <faridz@apache.com>

	* tests/include/rw_file.h: Replaced _MSC_VER to _WIN32 in
	preprocessor directive to use correct file name on MinGW.


	2008-07-04  Farid Zaripov  <faridz@apache.com>

	* tests/src/printf.cpp (_rw_fmtfloating): Use workaround for
	MSVC on MinGW too since MinGW uses MSVC's runtime.


	2008-07-04  Farid Zaripov  <faridz@apache.com>

	* include/rw/_config-gcc.h [__MINGW32__]: Add MinGW specific defines.
	* tests/localization/22.locale.cons.mt.cpp (test_ctors): Use MSVC
	specific workarounds on MinGW too.
	* tests/localization/22.locale.time.put.cpp (rw_strftime): Ditto.
	* util/gencat.cpp [__MINGW32__] (main): Create message catalog dll's
	independent on cygwin1.dll.


	2008-07-05  Martin Sebor  <sebor@roguewave.com>

	* include/rw/_config-gcc.h: Corrected typos in comments.
	Added comments to clearly separate sections dealing with
	individual operating environments.


	2008-07-07  Farid Zaripov  <faridz@apache.com>

	* etc/config/makefile.rules: Added comment about TZ variable.


	2008-07-07  Martin Sebor  <sebor@roguewave.com>

	STDCXX-988
	* include/ansi/limits.h [__GNUG__]: Used #include_next twice to coax
	gcc's <limits.h> to pull in the system <limits.h> in order to #define
	POSIX and system macros.
	* tests/regress/18.c.limits.stdcxx-988.cpp: Regression test for
	STDCXX-988. Tested with gcc 4.1.2 and EDG eccp 3.9 on Fedora 8.


	2008-07-09  Eric Lemings <eric.lemings@roguewave.com>

	STDCXX-550
	* tests/utilities/20.operators.cpp (test_random_access_iterators):
	Account for debug iterators on HP-UX platforms.


	2008-07-09  Eric Lemings <eric.lemings@roguewave.com>

	STDCXX-550
	* tests/utilities/20.operators.cpp (test_random_access_iterator):
	Oops.  Should be `!defined' in #if directive.


	2008-07-11  Martin Sebor  <sebor@roguewave.com>

	* src/wcodecvt.cpp (size_t): Used type throughout in place of
	the _RWSTD_SIZE_T macro which is necessary in library headers.


	2008-07-17  Martin Sebor  <sebor@roguewave.com>

	STDCXX-494
	* include/vector (vector): Removed Allocator base class, replacing
	it (in a binary compatible way) with a new member, _C_alloc, instead.
	(_C_value_alloc_type): Removed member typedef.
	(vector): Initialized the _C_alloc member instead of allocator_type
	in all class ctors.
	(~vector, begin, end, size, max_size, empty, swap): Referenced
	_C_begin, _C_end, and _C_bufend indirectly, via the new _C_alloc
	member.
	(pop_back, push_back): Used the new _C_alloc member to destroy
	and construct elements.
	* include/vector.cc (_C_realloc, _C_destroy, _C_insert_1,
	_C_insert_n, _C_insert_range): Same as above.
	* tests/regress/23.vector.stdcxx-494: Added regression test for
	the vector part of the issue.


	2008-07-17  Martin Sebor  <sebor@roguewave.com>

	* tests/regress/18.c.limits.stdcxx-988.cpp (main): Avoided testing
	macros for specific values to prevent failures on non-conforming
	systems.


	2008-07-17  Martin Sebor  <sebor@roguewave.com>

	* etc/config/xfail.txt: Copied from trunk.


	2008-07-17  Martin Sebor  <sebor@roguewave.com>

	* tests/regress/18.c.limits.stdcxx-988.cpp [HP aCC] (main): Avoided
	testing LLONG_MAX and LLONG_MIN unless 199901L <= __STDC_VERSION__
	(otherwise the macros are deliberately not defined).


	2008-07-17  Martin Sebor  <sebor@roguewave.com>

	* test/strings/21.string.erase.cpp (test_erase): Cast actual
	function arguments to the target type to silence HP aCC 6.16
	remarks #4271-D: type conversion may lose sign.


	2008-07-17  Martin Sebor  <sebor@roguewave.com>

	STDCXX-780
	* tests/include/rw_streambuf.h (test): Aasserted a precondition
	to silence HP aCC 6/cadvise warning #20206-D: Out of bound access.


	2008-07-17  Martin Sebor  <sebor@roguewave.com>

	* tests/containers/23.deque.modifiers.cpp (exception_loop): Converted
	a signed int to size_type to silence HP aCC 6 remark #4271-D: type
	conversion may lose sign.


	2008-07-17  Martin Sebor  <sebor@roguewave.com>

	STDCXX-896
	* tests/containers/23.deque.modifiers.cpp (test_insert, test_assign):
	Cast away the constness of the target type before deleting a pointer
	to work around an HP aCC 6.16 bug.


	2008-07-18  Martin Sebor  <sebor@roguewave.com>

	* examples/manual/wctype.cpp: New example showcasing the wchar_t
	specialization of the std::ctype_byname facet along with the wide
	character classification functions, inspired by the following post
	to the Sun C++ discussion forum:
	http://forums.sun.com/thread.jspa?threadID=5315069.


	2008-07-19  Martin Sebor  <sebor@roguewave.com>

	STDCXX-997
	* src/strtol.cpp [__SUNPRO_CC] (__rw_strtol, __rw_strtoul): Used
	#pragma no_side_effects to help Sun C++ optimizer generate better
	code (about 5% improvement was measured).
	[__SUNPRO_CC && _RWSTD_LONG_LONG] (__rw_strtoll, __rw_strtoull):
	Same.


	2008-07-21  Eric Lemings  <eric.lemings@roguewave.com>

	STDCXX-808
	* tests/regress/27.streambuf.buffer.stdcxx-808.cpp: Add
	regression test case that has failed in previous releases.


	2008-07-21  Martin Sebor  <sebor@roguewave.com>

	STDCXX-999
	* NOTICE.txt: Updated year of copyright.


	2008-07-22  Eric Lemings  <eric.lemings@roguewave.com>

	STDCXX-808
	* tests/regress/27.streambuf.buffer.stdcxx-808.cpp: Add file
	header comment.


	2008-07-23  Martin Sebor  <sebor@roguewave.com>

	STDCXX-997
	* include/bitset [__SUNPRO_CC] (__rw_bitset, __rw_bit_count,
	__rw_shl, __rw_shr): Used #pragma no_side_effects to help the
	optimizer generate better code.


	2008-07-23  Martin Sebor  <sebor@roguewave.com>

	* include/bitset [__SUNPRO_CC] Spelled #pragma no_side_effect
	the same as in the manual (even if the compiler seems to grok
	it both ways).


	2008-07-26  Martin Sebor  <sebor@roguewave.com>

	STDCXX-998
	* include/rw/_defs.h [_RWSTD_ATTRIBUTE_NOTHROW] (_RWSTD_DECLARE_NOTHROW,
	_RWSTD_DEFINE_NOTHROW): Defined new helper macros to make it possible to
	declare functions with the attribute((nothrow)) when it's available and
	to use the empty exception specification to emulate the same feature
	when it isn't.
	(__rw_assert_fail): Used _RWSTD_DECLARE_NOTHROW.
	* include/rw/_config-gcc.h [gcc >= 3.3] (RWSTD_ATTRIBUTE_NOTHROW):
	Defined.


	2008-07-26  Martin Sebor  <sebor@roguewave.com>

	STDCXX-998
	* src/assert.cpp (U_STACK_TRACE, __rw_stack_trace, printstack,
	__rw_assert_fail): Declared nothrow.


	2008-07-26  Martin Sebor  <sebor@roguewave.com>

	STDCXX-998
	* src/strtol.h (__rw_strtol, __rw_strtoll): Declared nothrow.
	(__rw_strtoul, __rw_strtoull): Same.
	* src/strtol.cpp: Same.


	2008-07-28  Travis Vitek  <vitek@roguewave.com>

	* include/rw/_defs.h: Use _RWSTD_DECLARE_NOTHROW macro only after
	definition of _THROWS to avoid compile errors.


	2008-07-29  Martin Sebor  <sebor@roguewave.com>

	* include/loc/_moneypunct.h (~moneypunct): Explicitly declared
	to prevent the compiler from generating a definition (and vtable)
	in every translation unit that uses the class. Pursuant to
	STDCXX-998, made use of attribute((nothrow)) where available.
	* include/loc/_codecvt.h (~codecvt, ~codecvt_byname): Same.
	* include/loc/_collate.h (~collate, ~collate_byname): Same.
	* include/loc/_codecvt.cc (~codecvt, ~codecvt_byname): Defined.
	* include/loc/_moneypunct.cc (~moneypunct): Same.
	* include/loc/_collate.cc (~collate, ~collate_byname): Same.
	* src/collate.cpp (~collate, ~collate_byname): Same.
	* src/codecvt.cpp (~codecvt): Same.
	* src/wcodecvt.cpp (~codecvt, ~codecvt_byname): Defined.


	2008-07-29  Martin Sebor  <sebor@roguewave.com>

	* include/loc/_messages.h (~messages, ~messages_byname): Explicitly
	declared dtors to prevent the compiler from emitting function and
	vtable definition in every translation unit that uses the class.
	* include/loc/_money_put.h (~money_put): Same.
	* include/loc/_moneypunct.h (~moneypunct_byname): Same.
	* include/loc/_numpunct.h (~numpunct_byname): Same.
	* include/loc/_time_get.h (~time_get, ~time_get_byname): Same.
	* include/loc/_time_put.h (~time_put, ~time_put_byname): Same.
	* include/loc/_money_put.cc (~money_put): Defined.
	* include/loc/_time_get.cc (~time_get, ~time_get_byname): Same.
	* include/loc/_moneypunct.cc (~moneypunct_byname): Same.
	* include/loc/_messages.cc (~messages, ~messages_byname): Same.
	* include/loc/_numpunct.cc (~numpunct_byname): Same.
	* include/loc/_time_put.cc (~time_put, ~time_put_byname): Same.


	2008-07-29  Martin Sebor  <sebor@roguewave.com>

	* include/loc/_codecvt.h (codecvt_byname<char, char>): Added
	an explicit specialization to avoid having to explicitly
	instanting the primary template in order to emit the definition
	of (the now explicitly defined out-of-line, since rev 680756)
	virtual dtor needed in __rw::__rw_ct_codecvt().
	* src/codecvt.cpp (codecvt_byname<char, char>): Defined ctor
	and dtor.


	2008-07-30  Martin Sebor  <sebor@roguewave.com>

	* include/rw/_defs.h (_RWSTD_ATTRIBUTE_NOTHROW): Defined as a no-op
	when the attribute isn't supported by the compiler to make the macro
	portably usable.
	(__rw_assert_fail): Inverted the order of the function attribute
	and exception specification to prevent compiler errors.



git-svn-id: https://svn.apache.org/repos/asf/stdcxx/trunk@681826 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/NOTICE.txt b/NOTICE.txt
index 2689227..5cf3e18 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,12 +1,12 @@
 Apache C++ Standard Library - stdcxx
 
-Copyright 2005-2007 The Apache Software Foundation.
+Copyright 2005-2008 The Apache Software Foundation.
 
 This product includes software developed at The Apache Software Foundation
 (http://www.apache.org/).
 
 Portions of this software were developed at Rogue Wave Software, Inc.,
-Copyright (c) 1994-2007.
+Copyright (c) 1994-2008.
 
 This software contains code derived from the HP Standard Template Library,
 Copyright (c) 1994 Hewlett-Packard Company.
diff --git a/etc/config/gcc.config b/etc/config/gcc.config
index 9092236..89a26ca 100644
--- a/etc/config/gcc.config
+++ b/etc/config/gcc.config
@@ -106,7 +106,7 @@
 -compatibility_version 4 -current_version $(LIBVER)
 
     # use appropriate install_name
-    ifeq ($(shell [ $(OS_MAJOR) -eq 9 ] && echo 1), 1)
+    ifeq ($(shell [ $(OS_MAJOR) -ge 9 ] && echo 1), 1)
         LDSOFLAGS += -install_name @rpath/$(LIBNAME)
     else
         LDSOFLAGS += -install_name $(LIBNAME)
@@ -207,7 +207,9 @@
 endif
 
 ifeq ($(OSNAME),Darwin)
-    RPATH = -Wl,-rpath,
+    ifeq ($(shell [ $(OS_MAJOR) -ge 9 ] && echo 1), 1)
+        RPATH = -Wl,-rpath,
+    endif
 endif
 
 # debug/optimization options
diff --git a/etc/config/makefile.rules b/etc/config/makefile.rules
index e589ec7..af07bef 100644
--- a/etc/config/makefile.rules
+++ b/etc/config/makefile.rules
@@ -158,6 +158,9 @@
 # creates and sets the POSIX TMPDIR environment variable to a temporary
 # directory before running the programs which is then removed when done
 #
+# The variable TZ is used in examples and initialized in GNUmakefile.exm
+# (see rev.561060)
+#
 # PlumHall specific:
 # for all "top level" tests that failed to build, find and build all
 # subtests (the little tests the main test consists of)
@@ -168,6 +171,7 @@
         PATH=$$PATH:.;                                                    \
         TOPDIR=$(TOPDIR);                                                 \
         TMPDIR=$${TMPDIR:-/tmp}/stdcxx-run-$$$$;                          \
+        TZ=$(TZ);                                                         \
         export LD_LIBRARY_PATH PATH TMPDIR TOPDIR TZ;                     \
         trap "rm -rf $$TMPDIR" HUP INT QUIT TERM EXIT;                    \
         mkdir -p $$TMPDIR;                                                \
@@ -181,6 +185,7 @@
         PATH=$$PATH:$(LIBDIR):$(BINDIR):.;                                \
         TOPDIR=$(TOPDIR);                                                 \
         TMPDIR=$${TMPDIR:-/tmp}/stdcxx-run-$$$$;                          \
+        TZ=$(TZ);                                                         \
         export LD_LIBRARY_PATH PATH TMPDIR TOPDIR TZ;                     \
         trap "rm -rf $$TMPDIR" HUP INT QUIT TERM EXIT;                    \
         mkdir -p $$TMPDIR;                                                \
diff --git a/examples/manual/wctype.cpp b/examples/manual/wctype.cpp
new file mode 100644
index 0000000..0cce4a6
--- /dev/null
+++ b/examples/manual/wctype.cpp
@@ -0,0 +1,193 @@
+/**************************************************************************
+ *
+ * wctype.cpp - Example program showcasing the wchar_t specialization
+ *              of the std::ctype_byname facet, inspired by a Sun C++
+ *              forum post:
+ *              http://forums.sun.com/thread.jspa?threadID=5315069
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ * Copyright 2008 Rogue Wave Software, Inc.
+ * 
+ **************************************************************************/
+
+#include <cwctype>     // for iswxxx(), wint_t
+#include <stdexcept>   // for runtime_error
+#include <iomanip>     // for setfill, setw
+#include <ios>         // for oct
+#include <iostream>    // for cerr, cout
+#include <locale>      // for isxxx(), locale
+
+
+static std::locale
+make_named_locale ()
+{
+    static const char* const
+    locale_names [] = {
+        "es_ES.ISO8859-1",       // AIX, Solaris, Tru64
+        "es_ES.iso88591",        // HP-UX, Linux
+        "es_ES.88591",
+        "De_DE.88591",           // Reliant
+        "es_ES",
+        "es",                    // Linux, Solaris
+        "Spanish",
+        "spanish",               // Linux
+        "espanol",               // Linux
+        "spanish_spain.1252",    // Windows
+        "POSIX",                 // POSIX systems
+        "C",                     // all C/C++ systems
+        0                        // (sentinel)
+    };
+
+    std::locale german;
+
+    // iterate over the know locale names above until a valid one
+    // is found (i.e., one that doesn't cause locale to throw)
+    for (const char* const *names = locale_names; ; ) {
+        try {
+            german = std::locale (names [0]);
+            break;
+        }
+        catch (std::runtime_error&) {
+            // continue trying until the next name is null
+            if (0 == *++names)
+                throw;
+        }
+        catch (...) {
+            throw;
+        }
+    }
+
+    return german;
+}
+
+
+int main ()
+{
+    std::locale locale;
+
+    try {
+        // try to contruct a named locale
+        locale = make_named_locale ();
+    }
+    catch (std::runtime_error& e) {
+        // a runtime_error will be thrown if the locale cannot be constructed
+        std::cerr << "Caught runtime_error:\n"; 
+        std::cerr << e.what () << '\n';
+
+        return 1;
+    }
+    catch (...) {
+        std::cerr << "Caught an unknown exception\n"; 
+
+        return 2;
+    }
+
+    // set the global C/C++ locale to be used by the C classification
+    // functions (such as iswalpha())
+    std::locale::global (locale);
+
+    // imbue the named locale in wcout
+    std::wcout.imbue (locale);
+
+    std::wcout << "Wide character classification in "
+               << locale.name ().c_str () << " locale.\n";
+
+
+    // number of mismatched classifications between C and C++
+    // (expect zero for 100% conforming implementation)
+    int mismatch_count = 0;
+
+    // iterate over all characters in the extended ASCII range
+    // printing out the value of each along with its character
+    // class using the letters A, a, C, D, G, L, P, p, S, U,
+    // and X to denote each of the C/C++ classes corresponding
+    // to the C and C++ classification functions
+    for (std::wint_t wi = 0; wi < std::wint_t (256); ++wi) {
+
+        // convert the wint_t to wchar_t
+        const wchar_t wc (wi);
+
+        char cxx_class [11];   // C++ classification letters
+        char c_class   [11];   // C classification letters
+
+        std::size_t i = 0;
+
+        // assign the appropriate letter for the C++ classification
+        cxx_class [i++] = (std::isalnum)(wc, locale)  ? 'A' : '-';
+        cxx_class [i++] = (std::isalpha)(wc, locale)  ? 'a' : '-';
+        cxx_class [i++] = (std::iscntrl)(wc, locale)  ? 'C' : '-';
+        cxx_class [i++] = (std::isdigit)(wc, locale)  ? 'D' : '-';
+        cxx_class [i++] = (std::isgraph)(wc, locale)  ? 'G' : '-';
+        cxx_class [i++] = (std::islower)(wc, locale)  ? 'L' : '-';
+        cxx_class [i++] = (std::isprint)(wc, locale)  ? 'P' : '-';
+        cxx_class [i++] = (std::ispunct)(wc, locale)  ? 'p' : '-';
+        cxx_class [i++] = (std::isspace)(wc, locale)  ? 'S' : '-';
+        cxx_class [i++] = (std::isupper)(wc, locale)  ? 'U' : '-';
+        cxx_class [i++] = (std::isxdigit)(wc, locale) ? 'X' : '-';
+
+        i = 0;
+
+        // assign the appropriate letter for the C classification
+        c_class [i++] = (std::iswalnum)(wc)  ? 'A' : '-';
+        c_class [i++] = (std::iswalpha)(wc)  ? 'a' : '-';
+        c_class [i++] = (std::iswcntrl)(wc)  ? 'C' : '-';
+        c_class [i++] = (std::iswdigit)(wc)  ? 'D' : '-';
+        c_class [i++] = (std::iswgraph)(wc)  ? 'G' : '-';
+        c_class [i++] = (std::iswlower)(wc)  ? 'L' : '-';
+        c_class [i++] = (std::iswprint)(wc)  ? 'P' : '-';
+        c_class [i++] = (std::iswpunct)(wc)  ? 'p' : '-';
+        c_class [i++] = (std::iswspace)(wc)  ? 'S' : '-';
+        c_class [i++] = (std::iswupper)(wc)  ? 'U' : '-';
+        c_class [i++] = (std::iswxdigit)(wc) ? 'X' : '-';
+
+        // print the value of the character and its glyph only when
+        // it's printable, otherwise print a space
+        std::wcout << "  '\\" << std::setw (3)
+                   << std::setfill (L'0') << std::oct << wi
+                   << "' ('" << ((std::isprint)(wc, locale) ? wc : L' ')
+                   << "')   ";
+
+        bool mismatch = false;
+
+        // print out the letters denoting each character class
+        for (i = 0; i != sizeof cxx_class; ++i) {
+
+            if (cxx_class [i] == c_class [i])
+                std::wcout << cxx_class [i] << ' ';
+            else {
+                std::wcout << cxx_class [i] << ':' << c_class [i] << ' ';
+                mismatch = true;
+            }
+        }
+
+        if (mismatch) {
+            std::wcout << "   *** C/C++ mismatch ***";
+
+            // increment the number of mimatched character classes
+            ++mismatch_count;
+        }
+
+        std::wcout << '\n';
+    }
+
+    return mismatch_count ? 1 : 0;
+}
diff --git a/include/ansi/limits.h b/include/ansi/limits.h
index 8fbe4ad..8b3c966 100644
--- a/include/ansi/limits.h
+++ b/include/ansi/limits.h
@@ -107,7 +107,12 @@
 #  endif
 
 #  ifdef __GNUC__
-     // use the gcc extension to #include the compiler's limits.h
+     // use the gcc extension to #include the compiler's <limits.h>
+#    include_next <limits.h>
+
+     // include the same file again to get it to #include the system
+     // <limits.h> (presumably residing /usr/include/)
+#    define _GCC_NEXT_LIMITS_H
 #    include_next <limits.h>
 #  else
 #    include _RWSTD_ANSI_C_LIMITS_H
diff --git a/include/ansi/setjmp.h b/include/ansi/setjmp.h
index a0804f6..9d2ebcf 100644
--- a/include/ansi/setjmp.h
+++ b/include/ansi/setjmp.h
@@ -48,4 +48,8 @@
 #  include _RWSTD_ANSI_C_SETJMP_H
 #endif   // _RWSTD_NO_DEPRECATED_C_HEADERS
 
+#ifndef setjmp
+#  define setjmp(env) setjmp (env)
+#endif
+
 #endif   // _RWSTD_SETJMP_H_INCLUDED
diff --git a/include/bitset b/include/bitset
index 60ede54..a0131f9 100644
--- a/include/bitset
+++ b/include/bitset
@@ -58,6 +58,10 @@
              _RWSTD_SIZE_T, _RWSTD_SIZE_T,
              const char*, const char*);
 
+#ifdef __SUNPRO_CC
+#  pragma no_side_effect (__rw_bitset)
+#endif   // Sun C++
+
 #ifndef _RWSTD_NO_WCHAR_T
 
 _RWSTD_SPECIALIZED_FUNCTION
@@ -68,6 +72,9 @@
              _RWSTD_SIZE_T, _RWSTD_SIZE_T,
              const char*, const char*);
 
+#  ifdef __SUNPRO_CC
+#    pragma no_side_effect (__rw_bitset)
+#  endif   // Sun C++
 #endif   // _RWSTD_NO_WCHAR_T
 
 // helper, implements bitset::count()
@@ -81,6 +88,10 @@
 _RWSTD_EXPORT void
 __rw_shr (unsigned long*, _RWSTD_SIZE_T, _RWSTD_SIZE_T) _THROWS (());
 
+#ifdef __SUNPRO_CC
+#  pragma no_side_effect (__rw_bit_count, __rw_shl, __rw_shr)
+#endif   // Sun C++
+
 }   // namespace __rw
 
 
diff --git a/include/loc/_codecvt.cc b/include/loc/_codecvt.cc
index 0a99596..df2f7f1 100644
--- a/include/loc/_codecvt.cc
+++ b/include/loc/_codecvt.cc
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -35,7 +35,26 @@
 template <class _InternT, class _ExternT, class _StateT>
 _RW::__rw_facet_id codecvt<_InternT, _ExternT, _StateT>::id;
 
+
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _InternT, class _ExternT, class _StateT>
+/* virtual */ codecvt<_InternT, _ExternT, _StateT>::
+~codecvt () /* nothrow */
+{
+    // no-op
+}
+
 #endif   // _RWSTD_NO_EXT_CODECVT_PRIMARY
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _InternT, class _ExternT, class _StateT>
+/* virtual */ codecvt_byname<_InternT, _ExternT, _StateT>::
+~codecvt_byname () /* nothrow */
+{
+    // no-op
+}
+
 }   // namespace std
diff --git a/include/loc/_codecvt.h b/include/loc/_codecvt.h
index 2e91b41..13a7738 100644
--- a/include/loc/_codecvt.h
+++ b/include/loc/_codecvt.h
@@ -120,6 +120,8 @@
 
     explicit codecvt (_RWSTD_SIZE_T __ref = 0): _RW::__rw_facet (__ref) { }
 
+    virtual ~codecvt () _RWSTD_ATTRIBUTE_NOTHROW;
+
     // 22,2,1,5,1, p1
     result out (state_type& __state,
                 const intern_type* __from, const intern_type* __from_end,
@@ -188,7 +190,7 @@
 
     explicit codecvt (_RWSTD_SIZE_T = 0);
 
-    virtual ~codecvt ();
+    virtual ~codecvt () _RWSTD_ATTRIBUTE_NOTHROW;
 
     result out (state_type &__state,
                 const intern_type *__from, const intern_type* __from_end,
@@ -332,6 +334,8 @@
 
     explicit codecvt (_RWSTD_SIZE_T = 0);
 
+    virtual ~codecvt () _RWSTD_ATTRIBUTE_NOTHROW;
+
     result out (state_type& __state,
                 const intern_type *__from, const intern_type *__from_end,
                 const intern_type *&__from_next,
@@ -398,9 +402,26 @@
         : codecvt <_InternT, _ExternT, _StateT> (__ref) {
         this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
     }
+
+    virtual ~codecvt_byname () _RWSTD_ATTRIBUTE_NOTHROW;
 };
 
 
+_RWSTD_SPECIALIZED_CLASS
+class _RWSTD_EXPORT codecvt_byname<char, char, _RWSTD_MBSTATE_T>
+    : public codecvt<char, char, _RWSTD_MBSTATE_T>
+{
+    char _C_namebuf [32];
+
+public:
+
+    explicit codecvt_byname (const char*, _RWSTD_SIZE_T = 0);
+
+    virtual ~codecvt_byname () _RWSTD_ATTRIBUTE_NOTHROW;
+};
+
+
+
 #ifndef _RWSTD_NO_WCHAR_T
 
 _RWSTD_SPECIALIZED_CLASS
@@ -415,6 +436,8 @@
 
     explicit codecvt_byname (const char*, _RWSTD_SIZE_T = 0);
 
+    virtual ~codecvt_byname () _RWSTD_ATTRIBUTE_NOTHROW;
+
 protected:
 
     virtual codecvt_base::result
diff --git a/include/loc/_collate.cc b/include/loc/_collate.cc
index bc6175b..4c58bbb 100644
--- a/include/loc/_collate.cc
+++ b/include/loc/_collate.cc
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -35,6 +35,16 @@
 template <class _CharT>
 _RW::__rw_facet_id collate<_CharT>::id;
 
+
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT>
+/* virtual */ collate<_CharT>::
+~collate () /* nothrow */
+{
+    // no-op
+}
+
 #endif   // _RWSTD_NO_EXT_COLLATE_PRIMARY
 
 }   // namespace std
diff --git a/include/loc/_collate.h b/include/loc/_collate.h
index 1f3b350..5f2e892 100644
--- a/include/loc/_collate.h
+++ b/include/loc/_collate.h
@@ -25,7 +25,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -66,6 +66,8 @@
     explicit collate (_RWSTD_SIZE_T __refs = 0)
         : _RW::__rw_facet (__refs) { }
 
+    virtual ~collate () _RWSTD_ATTRIBUTE_NOTHROW;
+
     int
     compare (const char_type* __low1, const char_type* __high1,
              const char_type* __low2, const char_type* __high2) const {
@@ -113,6 +115,8 @@
     explicit collate (_RWSTD_SIZE_T __refs = 0)
         : _RW::__rw_facet (__refs) { }
 
+    virtual ~collate () _RWSTD_ATTRIBUTE_NOTHROW;
+
     int
     compare (const char_type* __low1, const char_type* __high1,
              const char_type* __low2, const char_type* __high2) const {
@@ -156,9 +160,11 @@
                          allocator<char_type> >
     string_type;
 
-    explicit collate (_RWSTD_SIZE_T __refs = 0)
+    explicit collate (_RWSTD_SIZE_T __refs = 0) _THROWS (())
         : _RW::__rw_facet (__refs) { }
 
+    virtual ~collate () _RWSTD_ATTRIBUTE_NOTHROW;
+
     int
     compare (const char_type* __low1, const char_type* __high1,
              const char_type* __low2, const char_type* __high2) const {
@@ -182,7 +188,7 @@
     virtual int
     do_compare (const char_type*, const char_type*,
                 const char_type*, const char_type*) const;
-        
+
     virtual string_type
     do_transform (const char_type*, const char_type*) const;
 
@@ -218,6 +224,8 @@
         this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
     }
 
+    virtual ~collate_byname () _RWSTD_ATTRIBUTE_NOTHROW;
+
 protected:
 
     virtual int
@@ -242,6 +250,8 @@
         this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
     }
 
+    virtual ~collate_byname () _RWSTD_ATTRIBUTE_NOTHROW;
+
 protected:
 
     virtual int
diff --git a/include/loc/_messages.cc b/include/loc/_messages.cc
index dcd2931..07ddeb8 100644
--- a/include/loc/_messages.cc
+++ b/include/loc/_messages.cc
@@ -36,6 +36,16 @@
 _RW::__rw_facet_id messages<_CharT>::id;
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT>
+/* virtual */ messages<_CharT>::
+~messages ()
+{
+    // no-op
+}
+
+
 template <class _CharT>
 messages_base::catalog
 messages<_CharT>::
@@ -141,4 +151,14 @@
 }
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT>
+/* virtual */ messages_byname<_CharT>::
+~messages_byname ()
+{
+    // no-op
+}
+
+
 }   // namespace std
diff --git a/include/loc/_messages.h b/include/loc/_messages.h
index 529dd46..91f7320 100644
--- a/include/loc/_messages.h
+++ b/include/loc/_messages.h
@@ -84,6 +84,7 @@
     explicit messages (_RWSTD_SIZE_T __refs = 0)
         : _RW::__rw_facet (__refs) { }
 
+    virtual ~messages () _RWSTD_ATTRIBUTE_NOTHROW;
 
     catalog open (const string& __fun, const locale& __loc) const {
         return do_open (__fun, __loc);
@@ -136,6 +137,8 @@
         : messages<_CharT>(__refs) {
         this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
     }
+
+    virtual ~messages_byname () _RWSTD_ATTRIBUTE_NOTHROW;
 };
 
 }   // namespace std
diff --git a/include/loc/_money_put.cc b/include/loc/_money_put.cc
index 059fe79..1b1d1d5 100644
--- a/include/loc/_money_put.cc
+++ b/include/loc/_money_put.cc
@@ -51,6 +51,16 @@
 _RW::__rw_facet_id money_put<_CharT, _OutputIter>::id;
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT, class _OutputIter>
+/* virtual */ money_put<_CharT, _OutputIter>::
+~money_put () /* nothrow */
+{
+    // no-op
+}
+
+
 template <class _CharT, class _OutputIter>
 /* private */ typename money_put<_CharT, _OutputIter>::iter_type
 money_put<_CharT, _OutputIter>::
diff --git a/include/loc/_money_put.h b/include/loc/_money_put.h
index a2b433c..d584ee8 100644
--- a/include/loc/_money_put.h
+++ b/include/loc/_money_put.h
@@ -63,6 +63,8 @@
     explicit money_put (_RWSTD_SIZE_T __ref = 0)
         : _RW::__rw_facet (__ref) { }
 
+    virtual ~money_put () _RWSTD_ATTRIBUTE_NOTHROW;
+
     // 22.2.6.2.1, p1
     iter_type put (iter_type __it, bool __intl, ios_base &__flags,
                    char_type __fill, long double __val) const {
diff --git a/include/loc/_moneypunct.cc b/include/loc/_moneypunct.cc
index da23ef8..23fece8 100644
--- a/include/loc/_moneypunct.cc
+++ b/include/loc/_moneypunct.cc
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -40,4 +40,25 @@
 
 #endif   // _RWSTD_NO_STATIC_CONST_MEMBER_INIT
 
+
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT, bool _Intl>
+/* virtual */ moneypunct<_CharT, _Intl>::
+~moneypunct () /* nothrow */
+{
+    // no-op
+}
+
+
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT, bool _Intl>
+/* virtual */ moneypunct_byname<_CharT, _Intl>::
+~moneypunct_byname () /* nothrow */
+{
+    // no-op
+}
+
+
 }   // namespace std
diff --git a/include/loc/_moneypunct.h b/include/loc/_moneypunct.h
index 160c420..be36d52 100644
--- a/include/loc/_moneypunct.h
+++ b/include/loc/_moneypunct.h
@@ -25,7 +25,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -68,6 +68,8 @@
     explicit moneypunct (_RWSTD_SIZE_T __refs = 0)
         : _RW::__rw_facet (__refs) { }
 
+    virtual ~moneypunct () _RWSTD_ATTRIBUTE_NOTHROW;
+
     char_type decimal_point () const {
         return do_decimal_point ();
     }
@@ -211,6 +213,8 @@
         : moneypunct<_CharT, _Intl>(__ref) {
             this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
         }
+
+    virtual ~moneypunct_byname () _RWSTD_ATTRIBUTE_NOTHROW;
 };
 
 
diff --git a/include/loc/_numpunct.cc b/include/loc/_numpunct.cc
index 39e09a3..e3016d1 100644
--- a/include/loc/_numpunct.cc
+++ b/include/loc/_numpunct.cc
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -36,8 +36,11 @@
 _RW::__rw_facet_id numpunct<_CharT>::id;
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
 template <class _CharT>
-/* virtual */ numpunct<_CharT>::~numpunct ()
+/* virtual */ numpunct<_CharT>::
+~numpunct () /* nothrow */
 {
     // no-op
 }
@@ -45,4 +48,14 @@
 // #endif   // _RWSTD_NO_EXT_NUMPUNCT_PRIMARY
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT>
+/* virtual */ numpunct_byname<_CharT>::
+~numpunct_byname () /* nothrow */
+{
+    // no-op
+}
+
+
 }   // namespace std
diff --git a/include/loc/_numpunct.h b/include/loc/_numpunct.h
index e5ab5be..b097882 100644
--- a/include/loc/_numpunct.h
+++ b/include/loc/_numpunct.h
@@ -238,6 +238,8 @@
         : numpunct<_CharT>(__refs) {
         this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
     }
+
+    virtual ~numpunct_byname () _RWSTD_ATTRIBUTE_NOTHROW;
 };
 
 }   // namespace std
diff --git a/include/loc/_time_get.cc b/include/loc/_time_get.cc
index 62bc2b7..805edf1 100644
--- a/include/loc/_time_get.cc
+++ b/include/loc/_time_get.cc
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -50,6 +50,16 @@
 _RW::__rw_facet_id time_get<_CharT, _InputIter>::id;
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT, class _InputIter>
+/* virtual */ time_get<_CharT, _InputIter>::
+~time_get ()
+{
+    // no-op
+}
+
+
 template <class _CharT, class _InputIter>
 typename time_get<_CharT, _InputIter>::iter_type
 time_get<_CharT, _InputIter>::
@@ -356,4 +366,14 @@
 }
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT, class _InputIter>
+/* virtual */ time_get_byname<_CharT, _InputIter>::
+~time_get_byname ()
+{
+    // no-op
+}
+
+
 }   // namespace std
diff --git a/include/loc/_time_get.h b/include/loc/_time_get.h
index 5f943ff..c6fe770 100644
--- a/include/loc/_time_get.h
+++ b/include/loc/_time_get.h
@@ -75,6 +75,8 @@
     explicit time_get (_RWSTD_SIZE_T __ref = 0)
         : _RW::__rw_facet (__ref) { }
 
+    virtual ~time_get () _RWSTD_ATTRIBUTE_NOTHROW;
+
     dateorder date_order() const { 
         return do_date_order(); 
     }
@@ -207,6 +209,8 @@
         : time_get<_CharT, _InputIter>(__ref) {
         this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
     }
+
+    virtual ~time_get_byname () _RWSTD_ATTRIBUTE_NOTHROW;
 };
 
 }   // namespace std
diff --git a/include/loc/_time_put.cc b/include/loc/_time_put.cc
index bc2f42b..0999d74 100644
--- a/include/loc/_time_put.cc
+++ b/include/loc/_time_put.cc
@@ -60,6 +60,16 @@
 _RW::__rw_facet_id time_put<_CharT, _OutputIter>::id;
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT, class _InputIter>
+/* virtual */ time_put<_CharT, _InputIter>::
+~time_put ()
+{
+    // no-op
+}
+
+
 template <class _CharT, class _OutputIter /* = ostreambuf_iterator<_CharT> */ >
 /* virtual */ typename time_put<_CharT, _OutputIter>::iter_type
 time_put<_CharT, _OutputIter>::
@@ -173,4 +183,14 @@
 }
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+template <class _CharT, class _OutputIter>
+/* virtual */ time_put_byname<_CharT, _OutputIter>::
+~time_put_byname ()
+{
+    // no-op
+}
+
+
 }   // namespace std
diff --git a/include/loc/_time_put.h b/include/loc/_time_put.h
index c63f468..1ad4389 100644
--- a/include/loc/_time_put.h
+++ b/include/loc/_time_put.h
@@ -61,6 +61,8 @@
     explicit time_put (_RWSTD_SIZE_T __refs = 0)
         : _RW::__rw_facet (__refs) { }
 
+    virtual ~time_put () _RWSTD_ATTRIBUTE_NOTHROW;
+
     // 22.2.5.3.1, p1
     iter_type put (iter_type, ios_base&, char_type, const tm*,
                    const char_type*, const char_type*) const;
@@ -106,6 +108,8 @@
         : time_put<_CharT, _OutputIter>(__ref) {
         this->_C_set_name (__name, _C_namebuf, sizeof _C_namebuf);
     }
+
+    virtual ~time_put_byname () _RWSTD_ATTRIBUTE_NOTHROW;
 };
 
 }   // namespace std
diff --git a/include/rw/_config-gcc.h b/include/rw/_config-gcc.h
index 95522ff..dbebf2e 100644
--- a/include/rw/_config-gcc.h
+++ b/include/rw/_config-gcc.h
@@ -88,6 +88,13 @@
 // (it may still exit by throwing an exception or by calling longjmp)
 #define _RWSTD_ATTRIBUTE_NORETURN   _RWSTD_GNUC_ATTRIBUTE ((noreturn))
 
+#if __GNUG__ > 3 || __GNUG__ == 3 && __GNUC_MINOR__ >= 3
+  // gcc attribute((nothrow)) to indicate that a function doesn't throw
+  // exceptions; unlike the emtpy exception specification the attribute
+  // avoids the cost of checking for exceptions and calling unexpected()
+#  define _RWSTD_ATTRIBUTE_NOTHROW   _RWSTD_GNUC_ATTRIBUTE ((nothrow))
+#endif   // gcc >= 3.3
+
 #ifdef _RWSTD_OS_LINUX
 
 #  ifdef _RWSTD_NO_NEW_HEADER
@@ -123,6 +130,7 @@
 
 #undef _RWSTD_NO_DEPRECATED_LIBC_IN_STD
 
+/*** CygWin ***************************************************************/
 #ifdef __CYGWIN__
      // use our own C++ libc headers
 #  undef _RWSTD_NO_NEW_HEADER
@@ -134,7 +142,7 @@
 #  endif
 
 #  ifdef _RWSHARED
-     // disabe exporting timeplate instantations in shared builds
+     // disable exporting tmeplate instantiations in shared builds
      // see STDCXX-507
 #    define _RWSTD_NO_EXTERN_TEMPLATE
 
@@ -145,6 +153,22 @@
 #  endif
 #endif   // __CYGWIN__
 
+/*** MinGW ****************************************************************/
+#ifdef __MINGW32__
+#  ifdef _RWSHARED
+     // disable exporting temeplate instantiations in shared builds
+     // see STDCXX-507
+#    define _RWSTD_NO_EXTERN_TEMPLATE
+#  endif
+
+   // operator new and delete is not reliably replaceable across
+   // shared library boundaries, which includes the shared library
+   // version of the language support library
+   // on MinGW the language support library is always shared
+#  define _RWSTD_NO_REPLACEABLE_NEW_DELETE
+#endif   // __MINGW32__
+
+/*** Tru64 UNIX ***********************************************************/
 #ifdef _RWSTD_OS_OSF1
       // sizeof (long double) == sizeof (double), 'L' causes SIGSEGV
 #   define _RWSTD_LDBL_PRINTF_PREFIX   ""
@@ -152,6 +176,7 @@
 
 #endif   // _RWSTD_OS_OSF1
 
+/*** Solaris **************************************************************/
 #ifdef _RWSTD_OS_SUNOS
 
      // _SOLARIS_THREADS #defined when the -threads option is used on SunOS
diff --git a/include/rw/_defs.h b/include/rw/_defs.h
index 3a6f83c..a3abc0f 100644
--- a/include/rw/_defs.h
+++ b/include/rw/_defs.h
@@ -1113,40 +1113,6 @@
 #  define _RWSTD_ASSUME(expr)   _RWSTD_ASSERT (expr)
 #endif   // _RWSTD_ASSUME
 
-#ifndef _RWSTD_ATTRIBUTE_NORETURN
-   // gcc (and others) __attribute__ ((noreturn))
-#  define _RWSTD_ATTRIBUTE_NORETURN   /* empty */
-#endif   // _RWSTD_ATTR_NORETURN
-
-
-// compile-time assertion - asserts constant expressions during
-// compilation with no runtime overhead; failed assertions are reported
-// as compilation errors
-
-_RWSTD_NAMESPACE (__rw) { 
-
-// file may be #included from within an extern "C" block
-extern "C++" {
-
-template <bool __b>
-struct __rw_compile_assert;
-
-_RWSTD_SPECIALIZED_CLASS
-struct __rw_compile_assert<true> { enum { _C_ok }; };
-
-#define _RWSTD_COMPILE_ASSERT(const_expr) \
-        ((void)_RW::__rw_compile_assert<(const_expr)>::_C_ok)
-
-// called for failed assertions
-void _RWSTD_EXPORT
-__rw_assert_fail (const char*, const char*, int, const char*)
-    _RWSTD_ATTRIBUTE_NORETURN;
-
-}   // extern "C++"
-
-}   // namespace __rw
-
-
 #define _RWSTD_STR(x)       #x
 #define _RWSTD_STRSTR(x)    _RWSTD_STR(x)
 
@@ -1197,6 +1163,62 @@
 #endif   // _RWSTD_NO_EXCEPTION_SPECIFICATION_ON_NEW
 
 
+#ifndef _RWSTD_ATTRIBUTE_NORETURN
+   // gcc (and others) __attribute__ ((noreturn))
+#  define _RWSTD_ATTRIBUTE_NORETURN   /* empty */
+#endif   // _RWSTD_ATTR_NORETURN
+
+
+#ifdef _RWSTD_ATTRIBUTE_NOTHROW
+   // gcc (and others) __attribute__ ((nothrow))
+#  define _RWSTD_DECLARE_NOTHROW  _RWSTD_ATTRIBUTE_NOTHROW
+   // attributes cannot appear on function definitions
+#  define _RWSTD_DEFINE_NOTHROW   /* empty */
+#else
+   // make the macro usable even when it doesn't do anything
+#  define _RWSTD_ATTRIBUTE_NOTHROW /* empty */
+   // emulate using empty exception specifications which must
+   // be specified for both declarations and definitions
+#  define _RWSTD_DECLARE_NOTHROW  _THROWS(())
+#  define _RWSTD_DEFINE_NOTHROW   _THROWS(())
+#endif   // _RWSTD_ATTR_NORETURN
+
+
+// compile-time assertion - asserts constant expressions during
+// compilation with no runtime overhead; failed assertions are reported
+// as compilation errors
+
+_RWSTD_NAMESPACE (__rw) { 
+
+// file may be #included from within an extern "C" block
+extern "C++" {
+
+template <bool __b>
+struct __rw_compile_assert;
+
+_RWSTD_SPECIALIZED_CLASS
+struct __rw_compile_assert<true> { enum { _C_ok }; };
+
+#define _RWSTD_COMPILE_ASSERT(const_expr) \
+        ((void)_RW::__rw_compile_assert<(const_expr)>::_C_ok)
+
+// called for failed assertions
+void _RWSTD_EXPORT
+__rw_assert_fail (const char*, const char*, int, const char*)
+    _RWSTD_DECLARE_NOTHROW _RWSTD_ATTRIBUTE_NORETURN;
+
+
+
+#ifdef __SUNPRO_CC
+   // help Sun C++ optimizer generate better code
+#  pragma does_not_return (__rw_assert_fail)
+#endif   // __SUNPRO_CC
+
+}   // extern "C++"
+
+}   // namespace __rw
+
+
 // for convenience
 #if    !defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)          \
     && (!defined (__SUNPRO_CC) || __SUNPRO_CC > 0x540)
diff --git a/include/vector b/include/vector
index 604499c..094556b 100644
--- a/include/vector
+++ b/include/vector
@@ -84,7 +84,7 @@
 
 _EXPORT
 template <class _TypeT, class _Allocator>
-class vector: private _Allocator
+class vector
 {
 public:
 
@@ -96,7 +96,6 @@
     typedef typename allocator_type::const_reference  const_reference;
     typedef typename allocator_type::pointer          pointer;
     typedef typename allocator_type::const_pointer    const_pointer;
-    typedef _RWSTD_ALLOC_TYPE (allocator_type, value_type) _C_value_alloc_type;
 
 public:
 
@@ -153,33 +152,32 @@
 
     explicit
     vector (const allocator_type &__alloc = allocator_type ())
-        : allocator_type (__alloc), _C_begin (), _C_end (), _C_bufend () { }
+        : _C_alloc (__alloc) { }
 
     explicit
     vector (size_type __n, const_reference __x = value_type (),
             const allocator_type &__alloc = allocator_type ())
-        : allocator_type (__alloc), _C_begin (), _C_end (), _C_bufend () {
+        : _C_alloc (__alloc) {
         assign (__n, __x);
     }
 
     template <class _InputIter>
     vector (_InputIter __first, _InputIter __last,
             const allocator_type &__alloc = allocator_type ())
-        : allocator_type (__alloc), _C_begin (), _C_end (), _C_bufend () {
+        : _C_alloc (__alloc) {
         assign (__first, __last);
     }
 
     vector (const vector &__rhs)
-        : allocator_type (__rhs.get_allocator ()),
-          _C_begin (), _C_end (), _C_bufend () {
+        : _C_alloc (__rhs.get_allocator ()) {
         assign (__rhs.begin (), __rhs.end ());
     }
     
     
     ~vector () { 
-        _C_destroy (begin ()); 
-        _RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this,
-                            deallocate (_C_begin, _C_bufend - _C_begin));
+        _C_destroy (begin ());
+        _C_alloc.deallocate (_C_alloc._C_begin,
+                             _C_alloc._C_bufend - _C_alloc._C_begin);
     }
     
     vector& operator= (const vector&);
@@ -195,23 +193,23 @@
     }
 
     allocator_type get_allocator () const {
-        return *this;
+        return _C_alloc;
     }
     
     iterator begin () {
-        return _C_make_iter (_C_begin);
+        return _C_make_iter (_C_alloc._C_begin);
     }
 
     const_iterator begin () const {
-        return _C_make_iter (_C_begin);
+        return _C_make_iter (_C_alloc._C_begin);
     }
 
     iterator end () {
-        return _C_make_iter (_C_end);
+        return _C_make_iter (_C_alloc._C_end);
     }
 
     const_iterator end () const {
-        return _C_make_iter (_C_end);
+        return _C_make_iter (_C_alloc._C_end);
     }
     
     reverse_iterator rbegin () { 
@@ -231,21 +229,21 @@
     }
 
     size_type size () const {
-        return size_type (_C_end - _C_begin);
+        return size_type (_C_alloc._C_end - _C_alloc._C_begin);
     }
 
     size_type max_size () const {
-        return _RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this, max_size ());
+        return _C_alloc.max_size ();
     }
     
     void resize (size_type, value_type = value_type ());
 
     size_type capacity () const {
-        return _C_bufend - _C_begin;
+        return _C_alloc._C_bufend - _C_alloc._C_begin;
     }
     
     bool empty () const {
-        return _C_begin == _C_end;
+        return _C_alloc._C_begin == _C_alloc._C_end;
     }
     
     void reserve (size_type);
@@ -282,8 +280,8 @@
     
     void pop_back () {
         _RWSTD_ASSERT (!empty ());
-        _RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this, destroy (_C_end - 1));
-        --_C_end;
+        _C_alloc.destroy (_C_alloc._C_end - 1);
+        --_C_alloc._C_end;
     }
 
     iterator insert (iterator, const_reference);
@@ -381,11 +379,9 @@
 
     // constructs a copy at the end and grows the size of container
     void _C_push_back (const_reference __x) {
-        _RWSTD_ASSERT (_C_end != _C_bufend);
-
-        _RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this,
-                            construct (_C_end, __x));
-        ++_C_end;
+        _RWSTD_ASSERT (_C_alloc._C_end != _C_alloc._C_bufend);
+        _C_alloc.construct (_C_alloc._C_end, __x);
+        ++_C_alloc._C_end;
     }
 
     // destroys elements from the iterator to the end of the vector
@@ -395,9 +391,16 @@
     // implements swap for objects with unequal allocator
     void _C_unsafe_swap (vector&);
 
-    pointer _C_begin;
-    pointer _C_end;
-    pointer _C_bufend;
+    struct _C_VectorAlloc: allocator_type {
+
+        _C_VectorAlloc (const allocator_type &__alloc)
+            : allocator_type (__alloc), _C_begin (), _C_end (), _C_bufend ()
+            { /* empty */}
+
+        pointer _C_begin;
+        pointer _C_end;
+        pointer _C_bufend;
+    } _C_alloc;
 };
 
 
@@ -495,12 +498,10 @@
 vector<_TypeT, _Allocator>::
 push_back (const_reference __x)
 {
-    if (_C_end == _C_bufend) {
+    if (_C_alloc._C_end == _C_alloc._C_bufend)
         _C_insert_1 (end (), __x);
-    }
-    else {
+    else
         _C_push_back (__x);
-    }
 }
 
 
@@ -535,8 +536,8 @@
     if (__next != end ()) 
         _STD::copy (__next, end (), __it);
 
-    _RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this, destroy (_C_end - 1));
-    --_C_end;
+    _C_alloc.destroy (_C_alloc._C_end - 1);
+    --_C_alloc._C_end;
 
     return __it;
 }
@@ -572,15 +573,15 @@
 swap (vector &__other)
 {
     if (get_allocator () == __other.get_allocator ()) {
-        pointer __tmp    = _C_begin;
-        _C_begin         = __other._C_begin;
-        __other._C_begin = __tmp;
-        __tmp            = _C_end;
-        _C_end           = __other._C_end;
-        __other._C_end   = __tmp;
-        __tmp            = _C_bufend;
-        _C_bufend        = __other._C_bufend;
-        __other._C_bufend = __tmp;
+        pointer __tmp             = _C_alloc._C_begin;
+        _C_alloc._C_begin         = __other._C_alloc._C_begin;
+        __other._C_alloc._C_begin = __tmp;
+        __tmp                     = _C_alloc._C_end;
+        _C_alloc._C_end           = __other._C_alloc._C_end;
+        __other._C_alloc._C_end   = __tmp;
+        __tmp                     = _C_alloc._C_bufend;
+        _C_alloc._C_bufend        = __other._C_alloc._C_bufend;
+        __other._C_alloc._C_bufend = __tmp;
     }
     else {
         // not exception-safe
diff --git a/include/vector.cc b/include/vector.cc
index 9935067..fc15934 100644
--- a/include/vector.cc
+++ b/include/vector.cc
@@ -82,20 +82,19 @@
     vector __tmp (get_allocator ());
 
     // allocate storage of requested capacity
-    __tmp._C_begin =
-        _RWSTD_VALUE_ALLOC (_C_value_alloc_type, __tmp,
-                            allocate (__cap, this));
+    __tmp._C_alloc._C_begin = _C_alloc.allocate (__cap, this);
 
     // initialize pointers
-    __tmp._C_end    = __tmp._C_begin;
-    __tmp._C_bufend = __tmp._C_begin + __cap;
+    __tmp._C_alloc._C_end    = __tmp._C_alloc._C_begin;
+    __tmp._C_alloc._C_bufend = __tmp._C_alloc._C_begin + __cap;
 
     // copy *this into the temporary one element at a time, as if
     // by calling std::unitialized_copy(), growing the temporary
     // at each iteration so that an exception thrown by the copy
     // ctor will cause the destruction of all already constructed
     // elements (by invoking the temporary's dtor)
-    for (pointer __ptr = _C_begin; !(__ptr == _C_end); ++__ptr) {
+    for (pointer __ptr = _C_alloc._C_begin; !(__ptr == _C_alloc._C_end);
+         ++__ptr) {
         __tmp._C_push_back (*__ptr);
     }
 
@@ -110,10 +109,8 @@
 {
     _RWSTD_ASSERT_RANGE (__first, end ());
 
-    _C_value_alloc_type __alloc = _RWSTD_VALUE_ALLOC_CAST (*this);
-
     for (size_type __n = end () - __first; !(0 == __n); --__n)
-        __alloc.destroy (--_C_end);
+        _C_alloc.destroy (--_C_alloc._C_end);
 }
 
 
@@ -170,12 +167,12 @@
 
         if (__it < end ()) {
 
-            const pointer __end = _C_end;
+            const pointer __end = _C_alloc._C_end;
 
             // construct a copy of the last element in the range [it, end)
             // in the uninitialized slot just past the end of the range
             // and bump up end()
-            _C_push_back (*(_C_end - difference_type (1)));
+            _C_push_back (*(_C_alloc._C_end - difference_type (1)));
 
             // move the remaining elements from the range above one slot
             // toward the end starting with the last element
@@ -218,36 +215,40 @@
         vector __tmp (get_allocator ());
         __tmp.reserve (__size2);
 
-        _RWSTD_ASSERT (!(pointer () == __tmp._C_end));
+        _RWSTD_ASSERT (!(pointer () == __tmp._C_alloc._C_end));
 
         iterator __i;
 
         // copy the initial range prior to `it' as if by a call to
-        // std::uninitialized_copy (begin (), __it, __tmp._C_begin);
+        // uninitialized_copy (begin (), __it, __tmp._C_alloc._C_begin);
         for (__i = begin (); !(__i == __it); ++__i) {
 
-            _RWSTD_ASSERT (!(__tmp._C_end == __tmp._C_bufend));
+            _RWSTD_ASSERT (!(   __tmp._C_alloc._C_end
+                             == __tmp._C_alloc._C_bufend));
 
             __tmp._C_push_back (*__i);
         }
 
         // construct `n' copies of `x' just past the initial range,
         // as if by a call to
-        // std::uninitialized_fill_n (__tmp._C_begin + __size1, __n, __x);
+        // uninitialized_fill_n (__tmp._C_aloc._C_begin + __size1, __n, __x);
         for ( ; __n; --__n) {
 
-            _RWSTD_ASSERT (!(__tmp._C_end == __tmp._C_bufend));
+            _RWSTD_ASSERT (!(   __tmp._C_alloc._C_end
+                             == __tmp._C_alloc._C_bufend));
 
             __tmp._C_push_back (__x);
         }
 
         // copy the final range of elements starting with `it'
         // as if by a call to
-        // uninitialized_copy (__it, end (), __tmp._C_begin + __size1 + __n);
+        // uninitialized_copy (__it, end (),
+        //                     __tmp._C_alloc._C_begin + __size1 + __n);
 
         for (__i = __it; !(__i == end ()); ++__i) {
 
-            _RWSTD_ASSERT (!(__tmp._C_end == __tmp._C_bufend));
+            _RWSTD_ASSERT (!(   __tmp._C_alloc._C_end
+                             == __tmp._C_alloc._C_bufend));
 
             __tmp._C_push_back (*__i);
         }
@@ -262,14 +263,12 @@
     // controlled by *this that need to be moved (copy contructed past
     // the end of the end of the sequence or assigned over existing
     // elements)
-    const pointer __movbeg = _C_begin + __size1;
+    const pointer __movbeg = _C_alloc._C_begin + __size1;
     const pointer __movend = __movbeg + __n;
 
     _RWSTD_ASSERT (_C_make_iter (__movbeg) == __it);
 
-    _C_value_alloc_type __alloc = _RWSTD_VALUE_ALLOC_CAST (*this);
-
-    if (__movend <= _C_end) {
+    if (__movend <= _C_alloc._C_end) {
 
         // the end of the range of existing elements after being
         // moved to make room for the elements to be inserted is
@@ -277,15 +276,16 @@
 
         // compute the beginning of the range of elements whose copies
         // will be constructed just past the current end of the sequence
-        const pointer __ucpbeg = _C_end - __n;
-        const pointer __ucpend = _C_end;
+        const pointer __ucpbeg = _C_alloc._C_end - __n;
+        const pointer __ucpend = _C_alloc._C_end;
 
         // construct copies of elements that will be moved beyond
         // the current end of the sequence controlled by *this
-        _STD::uninitialized_copy (__ucpbeg, _C_end, _C_end, __alloc);
+        _STD::uninitialized_copy (__ucpbeg, _C_alloc._C_end,
+                                  _C_alloc._C_end, _C_alloc);
 
         // advance end to maintain consistent state
-        _C_end += __n;
+        _C_alloc._C_end += __n;
 
         // copy elements the will be overwritten below
         // over the range of elements moved above
@@ -299,17 +299,17 @@
         const size_type __n1 = size () - __size1;
         const size_type __n2 = __n - __n1;
 
-        _STD::uninitialized_fill_n (_C_end, __n2, __x, __alloc);
+        _STD::uninitialized_fill_n (_C_alloc._C_end, __n2, __x, _C_alloc);
 
-        const pointer __end = _C_end;
+        const pointer __end = _C_alloc._C_end;
 
-        _C_end += __n2;
+        _C_alloc._C_end += __n2;
 
         // construct copies of the range of elements [pos, end)
         // past the end of the range of elements inserted above
-        _STD::uninitialized_copy (__movbeg, __end, _C_end, __alloc);
+        _STD::uninitialized_copy (__movbeg, __end, _C_alloc._C_end, _C_alloc);
 
-        _C_end += __end - __movbeg;
+        _C_alloc._C_end += __end - __movbeg;
 
         __n = __n1;
     }
@@ -323,8 +323,6 @@
 void vector<_TypeT, _Allocator>::
 _C_assign_range (_InputIter __first, _InputIter __last, input_iterator_tag)
 {
-    vector* const __self = this;
-
     _RWSTD_ASSERT_RANGE (__first, __last);
 
 #ifndef _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
@@ -343,17 +341,17 @@
     //    assignment operator and iterator operations do not throw
     // -- basic otherwise
 
-    const iterator __end = __self->end ();
+    const iterator __end = this->end ();
 
-    for (iterator __it = __self->begin (); __it != __end; ++__it, ++__first) {
+    for (iterator __it = this->begin (); __it != __end; ++__it, ++__first) {
         if (__first == __last) {
-            __self->erase (__it, __end);
+            this->erase (__it, __end);
             return;
         }
         *__it = *__first;
     }
 
-    __self->insert (__end, __first, __last);
+    this->insert (__end, __first, __last);
 
 #else   // if defined (_RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE)
 
@@ -363,8 +361,8 @@
     //    exactly distance(first, last) calls to value_type's copy ctor
     // exception safety: basic
 
-    __self->clear ();
-    __self->insert (__self->begin (), __first, __last);
+    this->clear ();
+    this->insert (this->begin (), __first, __last);
 
 #endif   // _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
 
@@ -376,8 +374,6 @@
 void vector<_TypeT, _Allocator>::
 _C_assign_range (_FwdIter __first, _FwdIter __last, forward_iterator_tag)
 {
-    vector* const __self = this;
-
     _RWSTD_ASSERT_RANGE (__first, __last);
 
 #ifndef _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
@@ -393,13 +389,13 @@
     // -- basic otherwise
 
     const size_type __size1 = _DISTANCE (__first, __last, size_type);
-    const size_type __size2 = __self->size () + __size1;
+    const size_type __size2 = this->size () + __size1;
 
-    if (__self->capacity () < __size2) {
+    if (this->capacity () < __size2) {
 
         // exception safety: strong
 
-        vector<value_type, allocator_type> __tmp (__self->get_allocator ());
+        vector<value_type, allocator_type> __tmp (this->get_allocator ());
         __tmp.reserve (__size2);
 
         // copy elements in the range [first, last) into the temporary
@@ -412,22 +408,22 @@
             __tmp._C_push_back (*__first);
 
         // swap *this with the temporary, having its dtor clean up
-        __self->swap (__tmp);
+        this->swap (__tmp);
     }
     else {
         // exception safety: nothrow or basic
 
-        const iterator __end = __self->end ();
+        const iterator __end = this->end ();
 
-        for (iterator __i = __self->begin (); __i != __end; ++__i, ++__first) {
+        for (iterator __i = this->begin (); __i != __end; ++__i, ++__first) {
             if (__first == __last) {
-                __self->erase (__i, __end);
+                this->erase (__i, __end);
                 return;
             }
             *__i = *__first;
         }
 
-        __self->insert (__end, __first, __last);
+        this->insert (__end, __first, __last);
     }
 
 #else   // if defined (_RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE)
@@ -437,8 +433,8 @@
     // complexity: linear in distance(first, last)
     // exception safety: basic
 
-    __self->clear ();
-    __self->insert (__self->begin (), __first, __last);
+    this->clear ();
+    this->insert (this->begin (), __first, __last);
 
 #endif   // _RWSTD_NO_EXT_VECTOR_ASSIGN_IN_PLACE
 
@@ -451,8 +447,6 @@
 _C_insert_range (iterator __it, _InputIter __first, _InputIter __last,
                  input_iterator_tag)
 {
-    vector* const __self = this;
-
     _RWSTD_ASSERT_RANGE (__it, end ());
     _RWSTD_ASSERT_RANGE (__first, __last);
 
@@ -467,34 +461,34 @@
     // append one element at a time to prevent the loss of data
     // from the input sequence in the case of an exception
 
-    const size_type __size = __self->size ();
-    const size_type __inx  = _DISTANCE (__self->begin (), __it, size_type);
+    const size_type __size = this->size ();
+    const size_type __inx  = _DISTANCE (this->begin (), __it, size_type);
 
     _RWSTD_ASSERT (__inx <= __size);
 
     for (; !(__first == __last); ++__first)
-        __self->push_back (*__first);
+        this->push_back (*__first);
 
     if (__inx < __size) {
         // swap the inserted elements with the elements before which
         // they should be inserted, as if by calling
-        // std::rotate (__beg, __mid, _C_end)
-        const pointer __beg = __self->_C_begin + __inx;
-        const pointer __mid = __self->_C_begin + __size;
+        // std::rotate (__beg, __mid, _C_alloc._C_end)
+        const pointer __beg = this->_C_alloc._C_begin + __inx;
+        const pointer __mid = this->_C_alloc._C_begin + __size;
 
         if (__beg < __mid) {
             for (pointer __p0 = __beg, __p1 = __mid; __p0 < --__p1; ++__p0)
                 _STD::iter_swap (__p0, __p1);
         }
 
-        if (__mid < __self->_C_end) {
-            for (pointer __p0 = __mid, __p1 = __self->_C_end;
+        if (__mid < this->_C_alloc._C_end) {
+            for (pointer __p0 = __mid, __p1 = this->_C_alloc._C_end;
                  __p0 < --__p1; ++__p0)
                 _STD::iter_swap (__p0, __p1);
         }
 
-        if (__beg < __self->_C_end) {
-            for (pointer __p0 = __beg, __p1 = __self->_C_end;
+        if (__beg < this->_C_alloc._C_end) {
+            for (pointer __p0 = __beg, __p1 = this->_C_alloc._C_end;
                  __p0 < --__p1; ++__p0)
                 _STD::iter_swap (__p0, __p1);
         }
@@ -515,14 +509,14 @@
     // insert input range into a temporary sequence rather than into *this
     // to coid modifying *this in case an exception (e.g., bad_alloc) is
     // thrown
-    vector<value_type, allocator_type> __tmp (__self->get_allocator ());
+    vector<value_type, allocator_type> __tmp (this->get_allocator ());
 
     for ( ; !(__first == __last); ++__first)
         __tmp.push_back (*__first);
 
     // insert into *this using a more efficient algorithm optimized
     // for BidirectionalIterator (and better)
-    __self->insert (__it, __tmp.begin (), __tmp.end ());
+    this->insert (__it, __tmp.begin (), __tmp.end ());
 
 #endif   // _RWSTD_NO_EXT_VECTOR_INSERT_IN_PLACE
 
@@ -535,8 +529,6 @@
 _C_insert_range (iterator __it, _FwdIter __first, _FwdIter __last,
                  forward_iterator_tag)
 {
-    vector* const __self = this;
-
     _RWSTD_ASSERT_RANGE (__it, end ());
     _RWSTD_ASSERT_RANGE (__first, __last);
 
@@ -544,7 +536,7 @@
     // unless the new size of the container would exceed its capacity
 
     // compute the sizes of the ranges of elements to be copied    
-    const size_type __size1 = _DISTANCE (__self->begin (), __it, size_type);
+    const size_type __size1 = _DISTANCE (this->begin (), __it, size_type);
     const size_type __size2 = _DISTANCE (__first, __last, size_type);
 
     if (!__size2)
@@ -552,7 +544,7 @@
 
 #ifndef _RWSTD_NO_EXT_VECTOR_INSERT_IN_PLACE
     const bool __insert_in_place =
-        __self->size () + __size2 <= __self->capacity ();
+        this->size () + __size2 <= this->capacity ();
 #else   // if defined (_RWSTD_NO_EXT_VECTOR_INSERT_IN_PLACE)
     const bool __insert_in_place = false;
 #endif   // _RWSTD_NO_EXT_VECTOR_INSERT_IN_PLACE
@@ -563,12 +555,12 @@
         // in the sequence controlled by *this that need to be moved
         // (copy contructed past the end of the end of the sequence
         // or assigned over existing elements)
-        const pointer __movbeg = __self->_C_begin + __size1;
+        const pointer __movbeg = this->_C_alloc._C_begin + __size1;
         const pointer __movend = __movbeg + __size2;
 
-        _RWSTD_ASSERT (__self->_C_make_iter (__movbeg) == __it);
+        _RWSTD_ASSERT (this->_C_make_iter (__movbeg) == __it);
 
-        const pointer __end = __self->_C_end;
+        const pointer __end = this->_C_alloc._C_end;
 
         if (__movend <= __end) {
             // compute the beginning of the range of elements whose copies
@@ -579,7 +571,7 @@
             // construct copies of elements that will be moved beyond
             // the current end of the sequence controlled by *this
             for (pointer __p = __ucpbeg; !(__p == __end); ++__p)
-                __self->_C_push_back (*__p);
+                this->_C_push_back (*__p);
 
             // over the range of elements moved above
             for (pointer __q = __end; __movend < __q; ) {
@@ -591,24 +583,24 @@
             // compute the length of the initial subsequence of the range
             // of elements being inserted that overlaps the end of the
             // sequence being inserted into
-            const size_type __size2a = __self->size () - __size1;
+            const size_type __size2a = this->size () - __size1;
             _FwdIter __mid = __first;
             _STD::advance (__mid, __size2a);
 
             // construct copies of the trailing subsequence of the range
             // of elements being inserted, as if by a call to
-            // std::uninitialized_copy (__mid, __last, _C_end);
+            // std::uninitialized_copy (__mid, __last, _C_alloc._C_end);
 
             for (_FwdIter __m = __mid ; !(__m == __last); ++__m)
-                __self->_C_push_back (*__m);
+                this->_C_push_back (*__m);
 
             // construct copies of the range of elements [pos, end)
             // past the end of the range of elements inserted above,
             // as if by a call to 
-            // std::uninitialized_copy (__movbeg, __end, _C_end);
+            // std::uninitialized_copy (__movbeg, __end, _C_alloc._C_end);
 
             for (pointer __p = __movbeg; !(__p == __end); ++__p)
-                __self->_C_push_back (*__p);
+                this->_C_push_back (*__p);
 
             __last = __mid;
         }
@@ -620,9 +612,9 @@
         // constructor or assignment operator of T there are no effects.
 
         // create a temporary vector and reserve sufficient space
-        vector<value_type, allocator_type> __tmp (__self->get_allocator ());
+        vector<value_type, allocator_type> __tmp (this->get_allocator ());
 
-        __tmp.reserve (__self->size () + __size2);
+        __tmp.reserve (this->size () + __size2);
 
         // avoid using the name __i or __it below so as not to trigger
         // a (bogus) gcc 2.95.2 -Wshadow warning: declaration of `__i'
@@ -635,7 +627,7 @@
         // iteration so that an exception thrown by the copy ctor
         // will cause the destruction of all already constructed
         // elements (by invoking the temporary's dtor)
-        for (__ix = __self->begin (); __ix != __it; ++__ix) {
+        for (__ix = this->begin (); __ix != __it; ++__ix) {
             __tmp._C_push_back (*__ix);
         }
 
@@ -647,12 +639,12 @@
         }
 
         // copy the remaining elements from *this
-        for ( ; __ix != __self->end (); ++__ix) {
+        for ( ; __ix != this->end (); ++__ix) {
             __tmp._C_push_back (*__ix);
         }
 
         // swap *this with the temporary, having its dtor clean up
-        __self->swap (__tmp);
+        this->swap (__tmp);
     }
 }
 
diff --git a/src/assert.cpp b/src/assert.cpp
index af77e28..78d2de0 100644
--- a/src/assert.cpp
+++ b/src/assert.cpp
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -37,7 +37,7 @@
 
 #ifdef __HP_aCC
 
-extern "C" void U_STACK_TRACE ();
+extern "C" void U_STACK_TRACE () _RWSTD_DECLARE_NOTHROW;
 
 #  define STACK_TRACE   U_STACK_TRACE
 
@@ -47,8 +47,14 @@
 
 _RWSTD_NAMESPACE (__rw) {
 
+// declare with attribute((nothrow)) since the function calls
+// others that may not be declared nothrow
 static void
-__rw_stack_trace (int fd)
+__rw_stack_trace (int fd) _RWSTD_DECLARE_NOTHROW;
+
+
+static void
+__rw_stack_trace (int fd) _RWSTD_DEFINE_NOTHROW
 {
     // limit stacktrace to the depth of 256 calls
     void* array [256];
@@ -70,7 +76,7 @@
 // having to #define enabling macros (i.e., __EXTENSIONS__) and deal
 // with the breakage when using a strict compiler such as EDG eccp
 // with the long long extension (used in some system headers) disabled
-extern "C" int printstack (int);
+extern "C" int printstack (int) _RWSTD_DECLARE_NOTHROW;
 
 #    define STACK_TRACE()   printstack (2)
 #endif
@@ -86,6 +92,7 @@
 _RWSTD_EXPORT void
 __rw_assert_fail (const char *expr,
                   const char *file, int line, const char *func)
+     _RWSTD_DEFINE_NOTHROW
 {
     // func may be 0 if the compiler doesn't support the ANSI C predefined
     // identifier `__func__' (see 6.4.2.2 of ISO/IEC 9899:1999) or an
diff --git a/src/codecvt.cpp b/src/codecvt.cpp
index 594b83f..59d7f80 100644
--- a/src/codecvt.cpp
+++ b/src/codecvt.cpp
@@ -105,7 +105,10 @@
 }
 
 
-/* virtual */ codecvt<char, char, _RWSTD_MBSTATE_T>::~codecvt ()
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+/* virtual */ codecvt<char, char, _RWSTD_MBSTATE_T>::
+~codecvt ()
 {
     // no-op
 }
@@ -265,6 +268,23 @@
 }
 
 
+codecvt_byname<char, char, _RWSTD_MBSTATE_T>::
+codecvt_byname (const char *name, size_t ref)
+    : codecvt <intern_type, extern_type, state_type> (ref)
+{
+    _C_set_name (name, _C_namebuf, sizeof _C_namebuf);
+}
+
+
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+/* virtual */ codecvt_byname<char, char, _RWSTD_MBSTATE_T>::
+~codecvt_byname ()
+{
+    // no-op
+}
+
+
 }   // namespace std
 
 #define TARGS_C   <char, char, _RWSTD_MBSTATE_T>
diff --git a/src/collate.cpp b/src/collate.cpp
index dc5013d..bfde23d 100644
--- a/src/collate.cpp
+++ b/src/collate.cpp
@@ -787,7 +787,7 @@
 
 
 template <class _CharT>
-long __rw_hash (const _CharT *lo, const _CharT *hi)
+long __rw_hash (const _CharT *lo, const _CharT *hi) _THROWS (())
 {
     // Peter Weinberger's generic hashing algorithm, adapted by Andrew
     // Binstock from a version by Allen Holub (see Andrew Binstock,
@@ -843,6 +843,15 @@
 _RW::__rw_facet_id collate<char>::id;
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+/* virtual */ collate<char>::
+~collate () /* nothrow */
+{
+    // no-op
+}
+
+
 int collate<char>::
 do_compare (const char_type *__lo1, const char_type *__hi1,
             const char_type *__lo2, const char_type *__hi2) const
@@ -888,6 +897,15 @@
 }
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+/* virtual */ collate_byname<char>::
+~collate_byname () /* nothrow */
+{
+    // no-op
+}
+
+
 int collate_byname<char>::
 do_compare (const char* low1, const char* high1,
             const char* low2, const char* high2) const
@@ -996,6 +1014,15 @@
 _RW::__rw_facet_id collate<wchar_t>::id;
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+/* virtual */ collate<wchar_t>::
+~collate () /* nothrow */
+{
+    // no-op
+}
+
+
 int collate<wchar_t>::
 do_compare (const char_type *__lo1, const char_type *__hi1,
             const char_type *__lo2, const char_type *__hi2) const
@@ -1062,6 +1089,15 @@
 }
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+/* virtual */ collate_byname<wchar_t>::
+~collate_byname () /* nothrow */
+{
+    // no-op
+}
+
+
 int collate_byname<wchar_t>::
 do_compare (const wchar_t* low1, const wchar_t* high1,
             const wchar_t* low2, const wchar_t* high2) const
diff --git a/src/strtol.cpp b/src/strtol.cpp
index 5fd37d2..f9cc1c1 100644
--- a/src/strtol.cpp
+++ b/src/strtol.cpp
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2006 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -192,7 +192,7 @@
 
 
 unsigned long
-__rw_strtoul (const char *nptr, int *errptr, int base)
+__rw_strtoul (const char *nptr, int *errptr, int base) _THROWS (())
 {
     _RWSTD_ASSERT (0 != nptr);
     _RWSTD_ASSERT (0 != errptr);
@@ -395,7 +395,7 @@
 
 
 long
-__rw_strtol (const char *nptr, int *errptr, int base)
+__rw_strtol (const char *nptr, int *errptr, int base) _THROWS (())
 {
     _RWSTD_ASSERT (0 != nptr);
     _RWSTD_ASSERT (0 != errptr);
@@ -626,7 +626,7 @@
 #  if (_RWSTD_LONG_SIZE < _RWSTD_LLONG_SIZE)
 
 ULLong
-__rw_strtoull (const char *nptr, int *errptr, int base)
+__rw_strtoull (const char *nptr, int *errptr, int base) _THROWS (())
 {
     _RWSTD_ASSERT (0 != nptr);
     _RWSTD_ASSERT (0 != errptr);
@@ -813,7 +813,7 @@
 
 
 LLong
-__rw_strtoll (const char *nptr, int *errptr, int base)
+__rw_strtoll (const char *nptr, int *errptr, int base) _THROWS (())
 {
     _RWSTD_ASSERT (0 != nptr);
     _RWSTD_ASSERT (0 != errptr);
diff --git a/src/strtol.h b/src/strtol.h
index b553e96..a041cff 100644
--- a/src/strtol.h
+++ b/src/strtol.h
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -35,11 +35,14 @@
 _RWSTD_EXPORT extern const unsigned char
 __rw_digit_map[];
 
+
+// same as strtoul() except that the source sequence must start
+// with a sign (either '+' or '-')
 unsigned long
- __rw_strtoul (const char*, int*, int);
+__rw_strtoul (const char*, int*, int) _THROWS (());
 
 long
- __rw_strtol (const char*, int*, int);
+__rw_strtol (const char*, int*, int) _THROWS (());
 
 
 #ifdef _RWSTD_LONG_LONG
@@ -49,7 +52,7 @@
 #  if (_RWSTD_LLONG_SIZE <= _RWSTD_LONG_SIZE)
 
 inline unsigned _RWSTD_LONG_LONG
-__rw_strtoull (const char *nptr, int *errptr, int base)
+__rw_strtoull (const char *nptr, int *errptr, int base) _THROWS (())
 {
     _RWSTD_ASSERT (sizeof (_RWSTD_LONG_LONG) == sizeof (long));
 
@@ -58,7 +61,7 @@
 
 
 inline _RWSTD_LONG_LONG
-__rw_strtoll (const char *nptr, int *errptr, int base)
+__rw_strtoll (const char *nptr, int *errptr, int base) _THROWS (())
 {
     _RWSTD_ASSERT (sizeof (_RWSTD_LONG_LONG) == sizeof (long));
 
@@ -68,13 +71,29 @@
 #  else   // if (_RWSTD_LLONG_SIZE > _RWSTD_LONG_SIZE)
 
 unsigned _RWSTD_LONG_LONG
-__rw_strtoull (const char*, int*, int);
+__rw_strtoull (const char*, int*, int) _THROWS (());
 
 _RWSTD_LONG_LONG
-__rw_strtoll (const char*, int*, int);
+__rw_strtoll (const char*, int*, int) _THROWS (());
 
 #  endif   // _RWSTD_LLONG_SIZE <= _RWSTD_LONG_SIZE
 #endif   // _RWSTD_LONG_LONG
 
 
+#ifdef __SUNPRO_CC
+
+   // tell the Sun C++ optimizer that the functions do not access
+   // for reading or writing any part of the program state (either
+   // visible at in the caller at the point of the call, or not)
+#  pragma no_side_effect (__rw_strtoul)
+#  pragma no_side_effect (__rw_strtol)
+
+#  ifdef _RWSTD_LONG_LONG
+#    pragma no_side_effect (__rw_strtoull)
+#    pragma no_side_effect (__rw_strtoll)
+#  endif   // _RWSTD_LONG_LONG
+
+#endif   // Sun C++
+
+
 }   // namespace __rw
diff --git a/src/wcodecvt.cpp b/src/wcodecvt.cpp
index e98856e..f17d69c 100644
--- a/src/wcodecvt.cpp
+++ b/src/wcodecvt.cpp
@@ -74,8 +74,8 @@
 
 #  undef _RWSTD_NO_MBRLEN
 
-extern "C" _RWSTD_SIZE_T
-mbrlen (const char*, _RWSTD_SIZE_T, _RWSTD_MBSTATE_T*) _LIBC_THROWS();
+extern "C" size_t
+mbrlen (const char*, size_t, _RWSTD_MBSTATE_T*) _LIBC_THROWS();
 
 #endif   // _RWSTD_NO_MBRLEN && !_RWSTD_NO_MBRLEN_IN_LIBC
 
@@ -87,7 +87,7 @@
 #  undef _RWSTD_NO_MBLEN
 
 extern "C" _RWSTD_SIZE_T
-mblen (const char*, _RWSTD_SIZE_T) _LIBC_THROWS();
+mblen (const char*, size_t) _LIBC_THROWS();
 
 #endif   // _RWSTD_NO_MBLEN && !_RWSTD_NO_MBLEN_IN_LIBC
 
@@ -99,7 +99,7 @@
 #  undef _RWSTD_NO_MBTOWC
 
 extern "C" int
-mbtowc (wchar_t*, const char*, _RWSTD_SIZE_T) _LIBC_THROWS();
+mbtowc (wchar_t*, const char*, size_t) _LIBC_THROWS();
 
 #endif   // _RWSTD_NO_MBTOWC && !_RWSTD_NO_MBTOWC_IN_LIBC
 
@@ -110,9 +110,8 @@
 
 #  undef _RWSTD_NO_WCSRTOMBS
 
-extern "C" _RWSTD_SIZE_T
-wcsrtombs (char*, const wchar_t**,
-           _RWSTD_SIZE_T, _RWSTD_MBSTATE_T*) _LIBC_THROWS();
+extern "C" size_t
+wcsrtombs (char*, const wchar_t**, size_t, _RWSTD_MBSTATE_T*) _LIBC_THROWS();
 
 #endif   // _RWSTD_NO_WCSRTOMBS && !_RWSTD_NO_WCSRTOMBS_IN_LIBC
 
@@ -123,7 +122,7 @@
 
 #  undef _RWSTD_NO_WCRTOMB
 
-extern "C" _RWSTD_SIZE_T
+extern "C" size_t
 wcrtomb (char*, wchar_t, _RWSTD_MBSTATE_T*) _LIBC_THROWS();
 
 #endif   // _RWSTD_NO_WCRTOMB && !_RWSTD_NO_WCRTOMB_IN_LIBC
@@ -237,7 +236,7 @@
     { "UCS-LE",      __rw_ucs_le }
 };
 
-static const _RWSTD_SIZE_T
+static const size_t
 __rw_n_ucsmods = sizeof __rw_ucsmods / sizeof *__rw_ucsmods;
 
 
@@ -270,10 +269,10 @@
 // behaves just like mbrlen(), except that if the character pointed to
 // by `str' is the NUL character and `emax' is non-zero, the function
 // returns 1
-static inline _RWSTD_SIZE_T
+static inline size_t
 __rw_libc_mbrlen (_RWSTD_MBSTATE_T &state,
                   const char       *str,
-                  _RWSTD_SIZE_T     emax)
+                  size_t            emax)
 {
     _RWSTD_ASSERT (0 != str);
 
@@ -313,7 +312,7 @@
 // does a simple transliteration of the UTF-8 encoded character string
 static unsigned int
 __rw_xlit (const _RW::__rw_codecvt_t* impl,
-           const char *utf8s, _RWSTD_SIZE_T sz)
+           const char *utf8s, size_t sz)
 {
     const unsigned int* const ptbls = impl->get_xliteration_tab ();
 
@@ -358,8 +357,8 @@
 
     // compute the length of the source sequence in bytes and
     // the size of the destination buffer in wide characters
-    _RWSTD_SIZE_T src_len  = from_end - from;
-    _RWSTD_SIZE_T dst_size = to_limit - to;
+    size_t src_len  = from_end - from;
+    size_t dst_size = to_limit - to;
 
     // set the initial values to the source and destination pointers
     const char* psrc = from;
@@ -368,7 +367,7 @@
     while (dst_size && src_len) {
 
         // the number of bytes that form the next multibyte character
-        _RWSTD_SIZE_T nbytes;
+        size_t nbytes;
 
 #ifndef _RWSTD_NO_MBRTOWC
         nbytes = mbrtowc (pdst, psrc, src_len, &state);
@@ -379,14 +378,14 @@
 #endif
 
         // -1 indicates an invalid sequence (i.e., error)
-        if (nbytes == (_RWSTD_SIZE_T)(-1)) {
+        if (nbytes == size_t (-1)) {
         res = _STD::codecvt_base::error;
             break;
         }
  
         // -2 indicates an ambiguous but valid subsequence
         // (i.e., ok)
-        if (nbytes == (_RWSTD_SIZE_T)(-2))
+        if (nbytes == size_t (-2))
             break;
 
         // 0 indicates the NUL character (skip over it)
@@ -410,8 +409,8 @@
     // range then we have a "partial" conversion
     if (res == _STD::codecvt_base::ok && src_len && !dst_size) {
         _RWSTD_MBSTATE_T tmp_state = state;
-        _RWSTD_SIZE_T tmp = __rw_libc_mbrlen (tmp_state, psrc, src_len);
-        if (tmp < (_RWSTD_SIZE_T)(-2))
+        size_t tmp = __rw_libc_mbrlen (tmp_state, psrc, src_len);
+        if (tmp < size_t (-2))
             res = _STD::codecvt_base::partial;
     }
 
@@ -442,15 +441,13 @@
 
     // save the value of MB_CUR_MAX and avoid repeatedly using
     // the macro for efficiency (it may expand to a function call)
-    const _RWSTD_SIZE_T mb_cur_max =
-        _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, MB_CUR_MAX);
+    const size_t mb_cur_max = size_t (MB_CUR_MAX);
 
     // the result of conversion
     _STD::codecvt_base::result res = _STD::codecvt_base::ok;
 
     // the size of the available space in the destination range
-    _RWSTD_SIZE_T dst_free =
-        _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, to_limit - to_next);
+    size_t dst_free = size_t (to_limit - to_next);
 
     // small temporary buffer used when the space in the destination
     // buffer is less than MB_CUR_MAX
@@ -472,7 +469,7 @@
 
         // the number of bytes in the resulting multibyte character
         // sequence, not including the terminating NUL
-        _RWSTD_SIZE_T dst_len = 0;
+        size_t dst_len = 0;
 
 #ifndef _RWSTD_NO_WCRTOMB
 
@@ -546,7 +543,7 @@
     // use libc locale to obtain the shift sequence
     char tmp [_RWSTD_MB_LEN_MAX];
 
-    _RWSTD_SIZE_T ret;
+    size_t ret;
 
 #ifndef _RWSTD_NO_WCRTOMB
     ret = wcrtomb (tmp, wchar_t (0), &state);
@@ -559,7 +556,7 @@
     if (_RWSTD_SIZE_MAX == ret)
         return  _STD::codecvt_base::error;
 
-    if (ret > (_RWSTD_SIZE_T)(to_limit - to_next)) {
+    if (ret > size_t (to_limit - to_next)) {
         // restore the state and return partial
         state = tmp_state;
         return _STD::codecvt_base::partial;
@@ -576,7 +573,7 @@
 // for validity by performing a number of computationally
 // relatively expensive tests; used only in strict mode
 static bool
-__rw_utf8validate (const char* from, _RWSTD_SIZE_T nbytes)
+__rw_utf8validate (const char* from, size_t nbytes)
 {
     _RWSTD_ASSERT (0 != from);
     _RWSTD_ASSERT (1 < nbytes && 7 > nbytes);
@@ -622,7 +619,7 @@
     if (6 == nbytes && 0xfcU == byte [0] && (byte [1] & 0xfcU) == 0x80U)
         return false;
 
-    for (_RWSTD_SIZE_T i = 1; i < nbytes; ++i) {
+    for (size_t i = 1; i < nbytes; ++i) {
         if ((byte [i] & ~0x3fU) != 0x80U)
             return false;   // invalid byte
     }
@@ -699,7 +696,7 @@
             if (strict_utf && tmp) {
 
                 // perform additional expensive UTF-8 validation
-                const _RWSTD_SIZE_T utf_len = tmp - from;
+                const size_t utf_len = tmp - from;
 
                 if (utf_len > 1 && !__rw_utf8validate (from, utf_len))
                     tmp = 0;
@@ -780,9 +777,9 @@
         }
 
         // compute the number of bytes available in the destination sequence
-        const _RWSTD_SIZE_T bytes_avail = to_limit - to_next;
+        const size_t bytes_avail = to_limit - to_next;
 
-        _RWSTD_SIZE_T utf8_len;
+        size_t utf8_len;
 
         if (impl) {
 
@@ -861,11 +858,11 @@
 
 
 // implements do_length() on top of libc mbrlen()
-static _RWSTD_SIZE_T 
+static size_t 
 __rw_libc_do_length (_RWSTD_MBSTATE_T &state,
                      const char       *from,
                      const char       *from_end,
-                     _RWSTD_SIZE_T     imax)
+                     size_t            imax)
 {
     const char* const from_begin = from;
 
@@ -873,7 +870,7 @@
 
         // compute the maximum length (in bytes) of the multibyte
         // character sequence starting at `from'
-        _RWSTD_SIZE_T nbytes = from_end - from;
+        size_t nbytes = from_end - from;
         if (_RWSTD_MB_LEN_MAX < nbytes)
             nbytes = _RWSTD_MB_LEN_MAX;
 
@@ -884,7 +881,7 @@
         nbytes = __rw_libc_mbrlen (state, from, nbytes);
 
         // stop when an invalid or incomplete character is encountered
-        if (nbytes >= (_RWSTD_SIZE_T)(-2))
+        if (nbytes >= size_t (-2))
             break;
 
         from += nbytes;
@@ -896,10 +893,10 @@
 
 
 // implements do_length() for UTF-8@UCS
-static _RWSTD_SIZE_T
+static size_t
 __rw_utf8_do_length (const char    *from,
                      const char    *from_end,
-                     _RWSTD_SIZE_T  imax,
+                     size_t         imax,
                      int            flags)
 {
     _RWSTD_ASSERT (from <= from_end);
@@ -924,7 +921,7 @@
         _RWSTD_ASSERT (next <= from_end);
 
         // perform additional expensive UTF-8 validation in strict mode
-        const _RWSTD_SIZE_T utf_len = next - from_next;
+        const size_t utf_len = next - from_next;
 
         if (   strict_utf
             && utf_len > 1 && !__rw_utf8validate (from_next, utf_len))
@@ -960,10 +957,10 @@
 // Note that the function returns the number of externT characters
 // (i.e., those of type char for the required instantiations).
 
-static _RWSTD_SIZE_T
+static size_t
 __rw_libstd_do_length (const char*                from,
                        const char*                from_end, 
-                       _RWSTD_SIZE_T              imax,
+                       size_t                     imax,
                        int                        flags,
                        const _RW::__rw_codecvt_t* impl)  
 {
@@ -1028,13 +1025,22 @@
 
 
 /* explicit */ codecvt<wchar_t, char, _RWSTD_MBSTATE_T>::
-codecvt (_RWSTD_SIZE_T __ref /* = 0 */)
+codecvt (size_t __ref /* = 0 */)
     : _RW::__rw_facet (__ref)
 {
     // no-op
 }
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+/* virtual */ codecvt<wchar_t, char, _RWSTD_MBSTATE_T>::
+~codecvt ()
+{
+    // no-op
+}
+
+
 /* virtual */ bool
 codecvt<wchar_t, char, _RWSTD_MBSTATE_T>::
 do_always_noconv () const _THROWS (())
@@ -1177,7 +1183,7 @@
 do_length (state_type        &state,
            const extern_type *from,
            const extern_type *from_end,
-           _RWSTD_SIZE_T      imax) const
+           size_t             imax) const
 {
     // 22.2.1.5.2, p9 - preconditions
     _RWSTD_ASSERT (from <= from_end);
@@ -1192,14 +1198,14 @@
         return 0;
 
     // 22.2.1.5.2, p10
-    const _RWSTD_SIZE_T len = from_end - from;
+    const size_t len = from_end - from;
     return int (len < imax ? len : imax);
 }
 
 
 // codecvt_byname <wchar,char> specialization
 codecvt_byname<wchar_t, char, _RWSTD_MBSTATE_T>:: 
-codecvt_byname (const char *name, _RWSTD_SIZE_T ref)
+codecvt_byname (const char *name, size_t ref)
     : codecvt<wchar_t, char, _RWSTD_MBSTATE_T>(ref)
 {
     _C_flags = _RW::__rw_encoding_from_name (name);
@@ -1224,14 +1230,14 @@
     if (mod) {
 
         const char* const   mod_nam = mod + 1;
-        const _RWSTD_SIZE_T mod_len = strlen (mod_nam);
+        const size_t        mod_len = strlen (mod_nam);
 
         // search for one of the known modifiers
         if (mod_len > 2 && !memcmp (mod_nam, "UCS", 3)) {
 
             int flags = 0;
 
-            for (_RWSTD_SIZE_T i = 0; i != _RW::__rw_n_ucsmods; ++i) {
+            for (size_t i = 0; i != _RW::__rw_n_ucsmods; ++i) {
                 if (!strcmp (_RW::__rw_ucsmods [i].mod, mod_nam)) {
                     flags = _RW::__rw_ucsmods [i].flags;
                     break;
@@ -1259,7 +1265,7 @@
     // denoting an external UTF encoding with strict validation rules
     // but slower processing, and their relaxed but faster equivalents,
     // utf-8, utf-16, utf-16-be, utf-16-le
-    const _RWSTD_SIZE_T name_len = strlen (name);
+    const size_t name_len = strlen (name);
 
     if (4 < name_len) {
 
@@ -1308,6 +1314,15 @@
 }
 
 
+// outlined to avoid generating a vtable in each translation unit
+// that uses the class
+/* virtual */ codecvt_byname<wchar_t, char, _RWSTD_MBSTATE_T>::~
+codecvt_byname ()
+{
+    // no-op
+}
+
+
 /* virtual */ codecvt_base::result
 codecvt_byname<wchar_t, char, _RWSTD_MBSTATE_T>::
 do_in (state_type&         state,
@@ -1552,7 +1567,7 @@
 do_length (state_type&        state, 
            const extern_type *from, 
            const extern_type *from_end, 
-           _RWSTD_SIZE_T      cmax) const 
+           size_t             cmax) const 
 {
     // 22.2.1.5.2 p1
     _RWSTD_ASSERT (from <= from_end);
@@ -1560,7 +1575,7 @@
     // verify that the range is valid
     _RWSTD_ASSERT (from && from_end || !from && !from_end);
 
-    _RWSTD_SIZE_T len = 0;
+    size_t len = 0;
 
     // test the type of the encoding that the facet is interpreting
     switch (ISO2022_TYPE (_C_flags)) {
@@ -1696,7 +1711,7 @@
 {
     // returns the max value do_length (s, from, from_end, 1) can return
     // for any valid range [from, from_end) - see LWG issue 74 (a DR)
-    _RWSTD_SIZE_T max_len = 0;
+    size_t max_len = 0;
 
     // test the type of the encoding that the facet is interpreting
     switch (ISO2022_TYPE (_C_flags)) {
@@ -1710,14 +1725,14 @@
             // use libc locale
             const _RW::__rw_setlocale clocale (_C_name, LC_CTYPE);
 
-            max_len = _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, MB_CUR_MAX);
+            max_len = size_t (MB_CUR_MAX);
         }
         else {
             // use own implementation
             if (IS_UTF8 (_C_flags))
                 max_len = _UTF8_MB_CUR_MAX;
             else if (impl)
-                max_len = _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, impl->mb_cur_max);
+                max_len = size_t (impl->mb_cur_max);
         }
         break;
     }
diff --git a/tests/containers/23.deque.modifiers.cpp b/tests/containers/23.deque.modifiers.cpp
index 4b121f4..992598f 100644
--- a/tests/containers/23.deque.modifiers.cpp
+++ b/tests/containers/23.deque.modifiers.cpp
@@ -190,10 +190,15 @@
 
         _TRY {
 
+            // convert an int to size_type to avoid conversion
+            // warnings when passing it to member functions
+            // that expect an unsigned argument
+            const Deque::size_type nelems (n);
+
             switch (mfun) {
             case Assign_n:
                 _RWSTD_ASSERT (x);
-                deq.assign (n, *x);
+                deq.assign (nelems, *x);
                 break;
             case AssignRange:
                 deq.assign (first, last);
@@ -214,7 +219,7 @@
                 break;
             case Insert_n:
                 _RWSTD_ASSERT (x);
-                deq.insert (it, n, *x);
+                deq.insert (it, nelems, *x);
                 break;
             case InsertRange:
                 deq.insert (it, first, last);
@@ -447,7 +452,10 @@
     std::free (funcall);
 
     delete[] xins;
-    delete[] xseq;
+
+    // cast away constness to work around an HP aCC 6.16 bug
+    // see http://issues.apache.org/jira/browse/STDCXX-802
+    delete[] _RWSTD_CONST_CAST (UserClass*, xseq);
 }
 
 /**************************************************************************/
@@ -975,7 +983,10 @@
     std::free (funcall);
 
     delete[] xasn;
-    delete[] xseq;
+
+    // cast away constness to work around an HP aCC 6.16 bug
+    // see http://issues.apache.org/jira/browse/STDCXX-802
+    delete[] _RWSTD_CONST_CAST (UserClass*, xseq);
 }
 
 
@@ -1177,7 +1188,9 @@
 
     std::free (funcall);
 
-    delete[] xseq;
+    // cast away constness to work around an HP aCC 6.16 bug
+    // see http://issues.apache.org/jira/browse/STDCXX-802
+    delete[] _RWSTD_CONST_CAST (UserClass*, xseq);
 }
 
 void test_erase ()
diff --git a/tests/include/rw_driver.h b/tests/include/rw_driver.h
index 13bb250..4b44120 100644
--- a/tests/include/rw_driver.h
+++ b/tests/include/rw_driver.h
@@ -98,7 +98,8 @@
  * @param line  When positive, denotes the line number of the location
  *        relevant to the diagnostic. Negative values are ignored.
  * @param fmtspec  A printf format specifier (with extensions) used
- *        to format the text of the diagnostic.
+ *        to format the text of the diagnostic.  See rwtest-fmtspec page
+ *        for details.
  * @param ... Optional list of values to format.
  *
  * @return  Returns the value of expr passed to it.
diff --git a/tests/include/rw_file.h b/tests/include/rw_file.h
index 8a92e1f..62b7f5f 100644
--- a/tests/include/rw_file.h
+++ b/tests/include/rw_file.h
@@ -33,17 +33,17 @@
 #include <rw_testdefs.h>   // for test config macros
 
 
-#ifndef _MSC_VER
+#ifndef _WIN32
    // POSIX special files:
    // http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap10.html
 #  define DEV_CONSOLE   "/dev/console"
 #  define DEV_NULL      "/dev/null"
 #  define DEV_TTY       "/dev/tty"
-#else   // if defined (_MSC_VER)
+#else   // if defined (_WIN32)
 #  define DEV_CONSOLE   "CON:"
 #  define DEV_NULL      "NUL:"
 #  define DEV_TTY       "CON:"
-#endif   // _MSC_VER
+#endif   // _WIN32
 
 
 #if _RWSTD_PATH_SEP == '/'
diff --git a/tests/include/rw_printf.h b/tests/include/rw_printf.h
index 3d90c03..7fc4b3a 100644
--- a/tests/include/rw_printf.h
+++ b/tests/include/rw_printf.h
@@ -79,7 +79,7 @@
 /**
  * Prints to a dynamically allocated character buffer.
  *
- * @param fmt  Format specifier.
+ * @param fmt  Format specifier.  See rwtest-fmtspec page for details.
  *
  * @return  On success, returns a pointer to the dynamically allocated
  *          character buffer. Otherwise, returns 0.
@@ -94,6 +94,7 @@
  * @param buf  A pointer to character buffer where the function should
  *        store its output.
  * @param bufise  The size of the character buffer in bytes.
+ * @param fmt  Format specifier.  See rwtest-fmtspec page for details.
  *
  * @return  On success, if the size of the supplied buffer was sufficient
  *          to format all characters including the terminating NUL, returns
@@ -124,34 +125,7 @@
  *        to by this argument to the size of the dynamically allocated
  *        character buffer, or leaves it unchanged if it doesn't allocate
  *        any buffer.
- * @param fmt  Format specifier.
- *        The format specifier string has the same syntax as C99 sprintf
- *        (see 7.19.6.1 of ISO/IEC 9899:1999) with the following extensions:
- *
- *        %n$          where n is a integer (see IEEE Std 1003.1)
- *        %m           the value of strerror(errno)
- *
- *        %{?}         if clause (extracts an int)
- *        %{:}         else clause
- *        %{;}         end of if/else clause
- *
- *        %{Ac}        quoted array of narrow characters
- *        %{*Ac}       quoted array of characters of width '*' each
- *                     where '*' is an int argument extracted from
- *                     the argument list
- *        %{#s}        quoted narrow character string
- *        %{#ls}       quoted wide character string
- *        %{$envvar}   value of an environment variable envvar
- *        %{f}         function pointer
- *        %{K}         signal name (such as "SIGABRT")
- *        %{M}         member pointer
- *        %{#m}        name of the errno constant (such as "EINVAL")
- *        %{n}         buffer size
- *        %{S}         pointer to std::string
- *        %{lS}        pointer to std::wstring
- *        %{tm}        pointer to struct tm
- *        %{InJ}       where n is one of { 8, 16, 32, 64 }
- *                     and J is one of { d, o, x, X }
+ * @param fmt  Format specifier.  See rwtest-fmtspec page for details.
  *
  * @return  On success, returns the number of characters formatted into
  *          the buffer, otherwise -1.
@@ -160,4 +134,227 @@
 rw_asnprintf (char** pbuf, _RWSTD_SIZE_T *pbufsize, const char *fmt, ...);
 
 
+/**
+ * @page rwtest-fmtspec Formated Output Directives and Conversion Specifiers
+ *
+ * The RWTest library supports all formatted output directives specified
+ * by the C99 standard as well as many other directive extensions.  Only
+ * deviations, extensions, and other implmementation-defined behavior are
+ * described below.  Consult your system and/or compiler documentation
+ * for specifications of the standard formatting output directives.
+ *
+ * Unless specified otherwise, the following caveats apply to all
+ * directives and conversions.  Directives that accept a pointer argument
+ * will convert a null pointer into the string literal <tt>(null)</tt>.
+ *
+ * Specifiers within formatting directives are denoted by angle brackets.
+ * The specifiers are placeholders whose range of possible values are
+ * listed in the description of the directive.
+ *
+ * @section rwtest-fmtspec-c89 C89 Directives
+ *
+ * @subsection rwtest-fmtspec-c89-ptr Pointer \%p \%\#p
+ *
+ * The argument is a pointer to \c void.  The value of the pointer is
+ * converted to a sequence of hexadecimal digits.  The number of
+ * converted digits depends on the size of the \c void* type.  The
+ * "alternate form" expressed by \c \%\#p immediately precedes converted
+ * digits with a \c 0x prefix.
+ *
+ *
+ * @section rwtest-fmtspec-c99 C99 Directives
+ *
+ * No known deviations or implementation-defined behavior.
+ *
+ *
+ * @section rwtest-fmtspec-ext RWTest Extensions
+ *
+ * @subsection rwtest-fmtspec-ext-bool Boolean \%b
+ *
+ * The argument is a value convertible to \c bool type.  If the value
+ * of the argument is nonzero, the value is converted to the string
+ * literal \c true.  Otherwise, the value converts to \c false.
+ *
+ * @subsection rwtest-fmtspec-ext-funptr Function Pointer \%{f}
+ *
+ * The argument is a pointer to a function.  The conversion and formatting
+ * is performed as specified by the \c \%p directive.
+ *
+ * @subsection rwtest-fmtspec-ext-memptr Member Pointer \%{M}
+ *
+ * The argument is a pointer to a composite member.  The conversion and
+ * formatting is performed as specified by the \c \%p directive.
+ *
+ * @subsection rwtest-fmtspec-ext-esc-c Escaped Character \%{c} \%{\#c}
+ *
+ * The argument is an integer value converted to <tt>unsigned char</tt>
+ * type.  For non-printable characters, the resulting output is formatted
+ * as the corresponding escape sequence.  (The value for a horizontal
+ * tab character for example is formatted as the string literal
+ * <tt>\\t</tt> and a zero value may be formatted as the string literal
+ * <tt>\\x00</tt>.  In the alternate form, the resulting output is
+ * immediately surrounded with a single quotation mark <tt>'</tt>.
+ *
+ * @subsection rwtest-fmtspec-ext-esc-lc Escaped Wide Character \%{lc} \%{\#lc}
+ *
+ * Similar to the escaped character directive <tt>%{c}</tt> and quoted
+ * escaped character directive <tt>%{\#c}</tt> respectively, except
+ * that the argument is a value of <tt>wchar_t</tt> type.
+ *
+ * @subsection rwtest-fmtspec-ext-s Quoted Character String \%{\#s}
+ *
+ * Similar to the character string directive <tt>%s</tt> except that the
+ * resulting output is surrounded with a double quotation mark <tt>"</tt>.
+ *
+ * @subsection rwtest-fmtspec-ext-ls Quoted Wide Character String \%{\#ls}
+ *
+ * Similar to the quoted character string directive <tt>%{\#s}</tt>
+ * except that the argument is a pointer to a null-terminate sequence of
+ * <tt>wchar_t</tt> type.
+ *
+ * @subsection rwtest-fmtspec-ext-err Error Code \%m \%{\#m}
+ *
+ * The argument is an integer value representing a system-dependent error
+ * code.  In the first form, the value is interpreted as an argument of
+ * the \c strerror() function.  The formatted result is the return value
+ * of this function using this parameter value.  In the second form, the
+ * formatted result is a character sequence representing the
+ * corresponding error name (e.g. \c ENOMEM) if applicable or equivalent
+ * numeric sequence in decimal notation otherwise.
+ *
+ * @subsection rwtest-fmtspec-ext-sig Signal \%K
+ *
+ * The argument is an integer value representing a system-dependent
+ * signal.  The resulting output is a character sequence representing
+ * the name of corresponding signal (e.g. \c SIGABRT) if
+ * applicable or equivalent numeric sequence in decimal notation
+ * otherwise.
+ *
+ * @subsection rwtest-fmtspec-ext-bits Bitset \%{b}
+ *
+ * The argument is a pointer to an array of \c char.  Each bit in the
+ * array, ordered from MSB of the first element to LSB of the last
+ * element is converted into a sequence of '0' or '1' characters.
+ *
+ * @subsection rwtest-fmtspec-ext-Ai Integer Array \%{Ac} \%{Ao} \%{Ad} \%{Ax}
+ *
+ * The argument is a pointer to an array of integer type.  The resulting
+ * output is formatted as a string of comma-separated integer values.
+ * The notation of each integer value is specified by <tt>c</tt> for
+ * characters, <<tt>o</tt> for octal, <tt>d</tt> for decimal, or
+ * <tt>x</tt> for hexadcimal.  An optional field width specifies the
+ * size of elements in the array (defaults to 1).  An optional precision
+ * specifies the length of the array.  In the alternate form, the
+ * resulting output for octal and hexidecimal integer values are
+ * prefixed with string literals <tt>0</tt> and <tt>0x</tt> respectively.
+ *
+ * @subsection rwtest-fmtspec-ext-I Fixed-Width Integers \%{I<wn>}
+ *
+ * The argument is a value of an integer type.  The directive requires
+ * two specifiers: the <tt>w</tt> specifier is one of 8, 16, 32, or 64
+ * specifying the width of the integer value.  The <tt>n</tt> specifier
+ * is one of \c d, \c o, \c x, or \c X specifying the notation of the
+ * resulting output.
+ *
+ * @subsection rwtest-fmtspec-ext-Is Stream State \%{Is} \%{\#Is}
+ *
+ * The argument is a value of type <tt>std::ios_base::iostate</tt>.  In
+ * the plain form, the resulting ouput is formatted as a sequence of one
+ * or more unqualified names corresponding to the \c iostate enumerators,
+ * separated by the OR operator (<tt>|</tt>).  In the extended form, the
+ * resulting output is prefixed with the string literal
+ * <tt>std::ios_base::</tt> indicating the qualfied namespace.
+ *
+ * @subsection rwtest-fmtspec-ext-Io Open Mode \%{Io} \%{\#Io}
+ *
+ * Similar to the <tt>%{Is}</tt> directive except the argument is a
+ * value of the <tt>std::ios_base::openmode</tt> enumeration type and
+ * names in the resulting output correspond to enumerators of this type.
+ *
+ * @subsection rwtest-fmtspec-ext-Iw Seek Direction \%{Iw} \%{\#Iw}
+ *
+ * The argument is a value of type <tt>std::ios_base::seekdir</tt>.  In
+ * the plain form, the resulting ouput is formatted as the unqualified
+ * name corresponding to one of the \c seekdir enumerators.  In the
+ * extended form, the enumerator is qualified with the enclosing
+ * namespace.
+ *
+ * @subsection rwtest-fmtspec-ext-If Format Flag \%{If} \%{\#Iw}
+ *
+ * Similar to the <tt>%{Is}</tt> directive except the argument is a
+ * value of the <tt>std::ios_base::fmtflags</tt> enumeration type and
+ * names in the resulting output correspond to enumerators of this type.
+ *
+ * @subsection rwtest-fmtspec-ext-Lc Locate Category \%{Lc} \%{\#Lc}
+ *
+ * The argument is an integer type representing a constant defined by
+ * the C <tt>&lt;locale.h&gt;</tt> header (identified by an <tt>LC_</tt>
+ * prefix) or a <tt>std::locale::category</tt> constant defined by
+ * the C++ <tt>&lt;locale&gt;</tt> header.  The resulting output is
+ * formatted as a character string representing the name of the C or C++
+ * constant enclosed in square brackets (<tt>[</tt>) and <tt>]</tt>).
+ * In the alternate form, the formatted output for C++ constants is
+ * prefixed with the string literal <tt>std::locale::</tt> indicating
+ * the qualified namespace.
+ *
+ * @subsection rwtest-fmtspec-ext-LC Character Classifiers \%{LC} \%{\#LC}
+ *
+ * The argument is an integer type representing enumerators of the
+ * <tt>std::ctype_base::mask</tt> enumeration.  The resulting output is
+ * formatted as a character string representing the name of the
+ * enumerator enclosed in square brackets (<tt>[</tt>) and <tt>]</tt>).
+ * In the alternate form, the enumerator is prefixed with the string
+ * literal <tt>std::ctype_base::</tt> indicating the qualified
+ * namespace.
+ *
+ * @subsection rwtest-fmtspec-ext-pid Process Identifier \%{P}
+ *
+ * The argument is a value of the portable \c rw_pid_t type.  The
+ * resulting output is formatted as a numeric sequence of digits
+ * representing the corresponding process identifier.  The \c P
+ * specifier may be preceded by optional width, justification, and
+ * precision qualifiers.
+ * 
+ * @subsection rwtest-fmtspec-ext-str String \%{S}
+ *
+ * The argument is a pointer to an object of the \c std::string class.
+ * Otherwise, the pointer \c P is converted by calling the \c P->c_str()
+ * function and the result is formatted identical to the <tt>%s</tt>
+ * character string directive.
+ *
+ * @subsection rwtest-fmtspec-ext-wstr Wide String \%{lS}
+ *
+ * The argument is a pointer to an object of the \c std::wstring class.
+ * Conversion and formatting is performed as stated for the \c \%{S}
+ * directive.
+ *
+ * @subsection rwtest-fmtspec-ext-tm Time Structure \%{t} \%{\#t}
+ *
+ * The argument is a pointer to a \c tm structure.  If the pointer is
+ * null, the resulting output is the string literal \c (null).  In the
+ * plain form, the resulting output for a valid pointer is formatted
+ * similar (but not necessarily identical) to the return value of the
+ * \c asctime() function.  If the value of any structure member is
+ * outside its valid range, the resulting output is formatting using the
+ * alternate form.  In the alternate form, the resulting output is
+ * formatted as a comma-separated sequence of members enclosed in braces
+ * where each member is of the format "name=value [range]".  The
+ * "[range]" is only shown if the value is not in the valid range for
+ * the respective member.
+ *
+ * @subsection rwtest-fmtspec-ext-other Other Directives
+ *
+ * The following directives are also recognized by RWTest output
+ * functions but are heretofore undocumented.
+ *
+ * <ul>
+ * <li> \%{<n>} buffer size
+ * <li> \%{<n>$} positional parameter
+ * <li> \%{$<s>} environment variable
+ * <li> \%{?} \%{:} \%{;} conditionals
+ * <li> \%{@} nested format
+ * <li> \%{!} user-defined format
+ * </ul>
+ */
+
 #endif   // RW_PRINTF_H_INCLUDED
diff --git a/tests/include/rw_streambuf.h b/tests/include/rw_streambuf.h
index dfdff96..c8538ad 100644
--- a/tests/include/rw_streambuf.h
+++ b/tests/include/rw_streambuf.h
@@ -461,10 +461,14 @@
 {
     MyStreambuf* const self = _RWSTD_CONST_CAST (MyStreambuf*, this);
 
-    int inx = memfun_inx (which);
-    if (-1 == inx)
+    const int inx = memfun_inx (which);
+    if (inx < 0)
         return true;
 
+    // assert precondition to silence HP aCC 6/cadvise warning
+    // #20206-D: Out of bound access 
+    RW_ASSERT ((_RWSTD_SIZE_T)inx < sizeof ncalls_ / sizeof *ncalls_);
+
     // increment the counter tracking the number of calls made
     // to each member function; do so regardless of whether
     // an exception will be thrown below
diff --git a/tests/localization/22.locale.cons.mt.cpp b/tests/localization/22.locale.cons.mt.cpp
index d4bdbb5..784af10 100644
--- a/tests/localization/22.locale.cons.mt.cpp
+++ b/tests/localization/22.locale.cons.mt.cpp
@@ -126,7 +126,7 @@
 
             // verify that the locales were created correctly
             if (   std::locale::none == cat
-#ifdef _MSC_VER
+#if defined (_MSC_VER) || defined (__MINGW32__)
                 || std::locale::messages == cat
 #endif
                 || first == next) {
@@ -141,7 +141,7 @@
             const std::locale combined_2 (first, next, cat);
 
             if (   std::locale::none == cat
-#ifdef _MSC_VER
+#if defined (_MSC_VER) || defined (__MINGW32__)
                 || std::locale::messages == cat
 #endif
                 || first == next) {
diff --git a/tests/localization/22.locale.time.put.cpp b/tests/localization/22.locale.time.put.cpp
index d169cae..13d6c90 100644
--- a/tests/localization/22.locale.time.put.cpp
+++ b/tests/localization/22.locale.time.put.cpp
@@ -142,7 +142,7 @@
     if (!tmb)
         tmb = &tmp;
 
-#ifdef _MSC_VER
+#if defined (_MSC_VER) || defined (__MINGW32__)
 
     // ms crt aborts if you use out of range values in debug
     if (tmb->tm_hour < 0 || 24 <= tmb->tm_hour)
@@ -281,11 +281,11 @@
 
     const std::size_t n = std::strftime (buf, bufsize, patbuf, tmb);
 
-#else   // if !defined (_MSC_VER)
+#else   // !_MSC_VER && !__MINGW32__
 
     const std::size_t n = std::strftime (buf, bufsize, pat, tmb);
 
-#endif   // _MSC_VER
+#endif   // _MSC_VER || __MINGW32__
 
     RW_ASSERT (n < bufsize);
 
@@ -298,11 +298,12 @@
 { 
     static const std::tm tmp = std::tm ();
 
-#if !defined (_RWSTD_NO_WCSFTIME_WCHAR_T_FMAT) && !defined (_MSC_VER)
+#if    !defined (_RWSTD_NO_WCSFTIME_WCHAR_T_FMAT) \
+    && !defined (_MSC_VER) && !defined (__MINGW32__)
 
     std::size_t n = std::wcsftime (wbuf, bufsize, wpat, tmb ? tmb : &tmp);
 
-#else   // if defined (_RWSTD_NO_WCSFTIME) || defined (_MSC_VER)
+#else   // _RWSTD_NO_WCSFTIME || _MSC_VER || __MINGW32__
 
     char pat [1024];
     char buf [1024];
@@ -311,7 +312,7 @@
     std::size_t n = rw_strftime (buf, bufsize, pat, tmb ? tmb : &tmp);
     widen (wbuf, buf);
 
-#endif   // _RWSTD_NO_WCSFTIME, _MSC_VER
+#endif   // _RWSTD_NO_WCSFTIME, _MSC_VER, __MINGW32__
 
     RW_ASSERT (n < bufsize);
 
diff --git a/tests/regress/18.c.limits.stdcxx-988.cpp b/tests/regress/18.c.limits.stdcxx-988.cpp
new file mode 100644
index 0000000..e7d168e
--- /dev/null
+++ b/tests/regress/18.c.limits.stdcxx-988.cpp
@@ -0,0 +1,175 @@
+/************************************************************************
+ *
+ * 18.c.limits.stdcxx-988.cpp - regression test for STDCXX-988
+ *
+ * http://issues.apache.org/jira/browse/STDCXX-988
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ * 
+ **************************************************************************/
+
+#include <cassert>
+#include <limits.h>
+
+
+int main ()
+{
+#if    (defined __unix__ || defined __unix || defined unix) \
+    && !defined _RWSTD_EDG_ECCP
+
+    // According to POSIX (SUSv3), the following macros are required
+    // to be defined in <limits.h> (others, such as OPEN_MAX) are
+    // optional):
+    // http://www.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
+
+    // Runtime Increasable Values
+
+    // The magnitude limitations in the following list shall be fixed
+    // by specific implementations. An application should assume that
+    // the value supplied by <limits.h> in a specific implementation
+    // is the minimum that pertains whenever the application is run
+    // under that implementation. A specific instance of a specific
+    // implementation may increase the value relative to that supplied
+    // by <limits.h> for that implementation. The actual value supported
+    // by a specific instance shall be provided by the sysconf() function.
+
+    assert (BC_BASE_MAX        != 0 /* >= _POSIX2_BC_BASE_MAX */ );
+    assert (BC_DIM_MAX         != 0 /* >= _POSIX2_BC_DIM_MAX */ );
+    assert (BC_SCALE_MAX       != 0 /* >= _POSIX2_BC_SCALE_MAX */ );
+    assert (BC_STRING_MAX      != 0 /* >= _POSIX2_BC_STRING_MAX */ );
+    assert (CHARCLASS_NAME_MAX != 0 /* >= _POSIX2_CHARCLASS_NAME_MAX */ );
+    assert (COLL_WEIGHTS_MAX   != 0 /* >= _POSIX2_COLL_WEIGHTS_MAX */ );
+    assert (EXPR_NEST_MAX      != 0 /* >= _POSIX2_EXPR_NEST_MAX */ );
+    assert (LINE_MAX           != 0 /* >= _POSIX2_LINE_MAX */ );
+    assert (NGROUPS_MAX        != 0 /* >= _POSIX_NGROUPS_MAX */ );
+    assert (RE_DUP_MAX         != 0 /* >= _POSIX2_RE_DUP_MAX */ );
+
+    // Minimum Values
+
+    // The symbolic constants in the following list shall be defined
+    // in <limits.h> with the values shown. These are symbolic names
+    // for the most restrictive value for certain features on an
+    // implementation conforming to this volume of IEEE Std 1003.1-2001.
+    // Related symbolic constants are defined elsewhere in this volume
+    // of IEEE Std 1003.1-2001 which reflect the actual implementation
+    // and which need not be as restrictive. A conforming implementation
+    // shall provide values at least this large. A strictly conforming
+    // application must not require a larger value for correct operation.
+
+    // avoid testing specific values since they're not important here
+    // all we care is that the macros be defined (i.e., that thet are
+    // not somehow hidden or #undef'd by our implementation)
+
+    assert (_POSIX_ARG_MAX        != 0 /* ==  4096 */);
+    assert (_POSIX_CHILD_MAX      != 0 /* ==    25 */);
+    assert (_POSIX_HOST_NAME_MAX  != 0 /* ==   255 */);
+    assert (_POSIX_LINK_MAX       != 0 /* ==     8 */);
+    assert (_POSIX_LOGIN_NAME_MAX != 0 /* ==     9 */);
+    assert (_POSIX_MAX_CANON      != 0 /* ==   255 */);
+    assert (_POSIX_MAX_INPUT      != 0 /* ==   255 */);
+    assert (_POSIX_NAME_MAX       != 0 /* ==    14 */);
+    assert (_POSIX_NGROUPS_MAX    != 0 /* ==     8 */);
+    assert (_POSIX_OPEN_MAX       != 0 /* ==    20 */);
+    assert (_POSIX_PATH_MAX       != 0 /* ==   256 */);
+    assert (_POSIX_PIPE_BUF       != 0 /* ==   512 */);
+    assert (_POSIX_RE_DUP_MAX     != 0 /* ==   255 */);
+    assert (_POSIX_SSIZE_MAX      != 0 /* == 32767 */);
+    assert (_POSIX_STREAM_MAX     != 0 /* ==     8 */);
+    assert (_POSIX_SYMLINK_MAX    != 0 /* ==   255 */);
+    assert (_POSIX_SYMLOOP_MAX    != 0 /* ==     8 */);
+    assert (_POSIX_TTY_NAME_MAX   != 0 /* ==     9 */);
+    assert (_POSIX_TZNAME_MAX     != 0 /* ==     6 */);
+
+#  ifdef _POSIX2_VERSION
+
+    assert (_POSIX2_BC_BASE_MAX        != 0 /* ==   99 */);
+    assert (_POSIX2_BC_DIM_MAX         != 0 /* == 2048 */);
+    assert (_POSIX2_BC_SCALE_MAX       != 0 /* ==   99 */);
+    assert (_POSIX2_BC_STRING_MAX      != 0 /* == 1000 */);
+    assert (_POSIX2_CHARCLASS_NAME_MAX != 0 /* ==   14 */);
+    assert (_POSIX2_COLL_WEIGHTS_MAX   != 0 /* ==    2 */);
+    assert (_POSIX2_EXPR_NEST_MAX      != 0 /* ==   32 */);
+    assert (_POSIX2_LINE_MAX           != 0 /* == 2048 */);
+    assert (_POSIX2_RE_DUP_MAX         != 0 /* ==  255 */);
+
+#  endif   // _POSIX2_VERSION
+
+#endif   // UNIX && !EDG eccp
+
+    // Numerical Limits
+
+    // The values in the following lists shall be defined in <limits.h>
+    // and are constant expressions suitable for use in #if preprocessing
+    // directives. Moreover, except for {CHAR_BIT}, {DBL_DIG}, {DBL_MAX},
+    // {FLT_DIG}, {FLT_MAX}, {LONG_BIT}, {WORD_BIT}, and {MB_LEN_MAX},
+    // the symbolic names are defined as expressions of the correct type.
+
+    // If the value of an object of type char is treated as a signed
+    // integer when used in an expression, the value of {CHAR_MIN} is
+    // the same as that of {SCHAR_MIN} and the value of {CHAR_MAX} is
+    // the same as that of {SCHAR_MAX}. Otherwise, the value of
+    // {CHAR_MIN} is 0 and the value of {CHAR_MAX} is the same as that
+    // of {UCHAR_MAX}.
+
+    assert (CHAR_BIT   == 8);
+    assert (CHAR_MAX   == UCHAR_MAX || CHAR_MAX == SCHAR_MAX);
+    assert (CHAR_MIN   == SCHAR_MIN || CHAR_MIN == 0);
+    assert (INT_MAX    >= 2147483647);
+    assert (LONG_MAX   >= +2147483647);
+    assert (MB_LEN_MAX >= 1);
+    assert (SCHAR_MAX  == +127);
+    assert (SHRT_MAX   >= +32767);
+
+#ifndef _RWSTD_EDG_ECCP
+
+    // avoid exercising with the EDG eccp front end (strict mode)
+    assert (LONG_BIT   >= 32);
+    assert (SSIZE_MAX  >= _POSIX_SSIZE_MAX);
+    assert (WORD_BIT   >= 32);
+
+#endif   // EDG eccp
+
+    assert (UCHAR_MAX  >= 255);
+    assert (UINT_MAX   >= 4294967295);
+    assert (ULONG_MAX  >= 4294967295);
+    assert (USHRT_MAX  >= 65535);
+    assert (INT_MIN    <= -2147483647);
+    assert (LONG_MIN   != 0);
+    assert (SCHAR_MIN  == -128);
+    assert (SHRT_MIN   != 0);
+
+#ifndef _RWSTD_NO_LONG_LONG
+
+#  if !defined __HP_aCC || 199901L <= __STDC_VERSION__
+
+    // HP aCC defines LLONG_MAX and LLONG_MIN only in C99 mode
+    // i.e., with -AC99
+
+    assert (LLONG_MIN  != 0);
+    assert (LLONG_MAX  >= +9223372036854775807LL);
+    assert (ULLONG_MAX >= 18446744073709551615ULL);
+
+#  endif
+
+#endif   // _RWSTD_NO_LONG_LONG
+
+    return 0;
+}
diff --git a/tests/regress/23.vector.stdcxx-494.cpp b/tests/regress/23.vector.stdcxx-494.cpp
new file mode 100644
index 0000000..aefb8c8
--- /dev/null
+++ b/tests/regress/23.vector.stdcxx-494.cpp
@@ -0,0 +1,71 @@
+/************************************************************************
+ *
+ * 23.vector.stdcxx-494.cpp - regression test for STDCXX-494
+ *
+ * https://issues.apache.org/jira/browse/STDCXX-611
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ **************************************************************************/
+
+#include <cassert>   // for assert()
+#include <cstddef>   // for size_t
+#include <memory>    // for allocator
+#include <vector>    // for vector
+
+
+template <class T>
+struct EmptyAllocator: std::allocator<T>
+{
+    template <class U>
+    struct rebind { typedef EmptyAllocator<U> other; };
+
+    EmptyAllocator () { }
+    EmptyAllocator (const EmptyAllocator &rhs)
+        : std::allocator<T>(rhs) { }
+
+    template <class U>
+    EmptyAllocator (const EmptyAllocator<U> &rhs)
+        : std::allocator<T>(rhs) { }
+
+    void* operator new (std::size_t) { return 0; }
+    void operator delete (void*) { }
+};
+
+
+int main ()
+{
+    // verify that vector doesn't derive from allocator
+    // (otherwise the replacement operator new and delete
+    // are in conflict)
+
+    typedef std::vector<int, EmptyAllocator<int> > EmptyVector;
+
+    delete new EmptyVector;
+
+    // verifies empty base optimization
+    assert (sizeof (std::vector<int>) == sizeof (EmptyVector));
+
+    // assert that the size of vector is exactly 3 pointers
+    assert (sizeof (std::vector<int>) == 3 * sizeof (int*));
+
+    return 0;
+}
diff --git a/tests/src/printf.cpp b/tests/src/printf.cpp
index 0f7e237..3c5dd94 100644
--- a/tests/src/printf.cpp
+++ b/tests/src/printf.cpp
@@ -1490,7 +1490,7 @@
 
     RW_ASSERT (size_t (len) < sizeof buffer);
 
-#ifdef _MSC_VER
+#if defined (_MSC_VER) || defined (__MINGW32__)
 
     if (5 < len) {
         // remove redundant zeros from the exponent (if present)
@@ -1502,7 +1502,7 @@
         }
     }
 
-#endif   // _MSC_VER
+#endif   // _MSC_VER || __MINGW32__
 
 
     if (-1 < len && 0 == _rw_bufcat (buf, buffer, size_t (len)))
diff --git a/tests/strings/21.string.erase.cpp b/tests/strings/21.string.erase.cpp
index 34c5eee..2386b52 100644
--- a/tests/strings/21.string.erase.cpp
+++ b/tests/strings/21.string.erase.cpp
@@ -363,6 +363,8 @@
     // pointer to the returned reference
     const String* ret_ptr = 0;
 
+    typedef typename String::size_type size_type;
+
     try {
         switch (func.which_) {
 
@@ -371,11 +373,12 @@
             break;
 
         case Erase (size):
-            ret_ptr = &str.erase (tcase.off);
+            ret_ptr = &str.erase (size_type (tcase.off));
             break;
 
         case Erase (size_size):
-            ret_ptr = &str.erase (tcase.off, tcase.size);
+            ret_ptr = &str.erase (size_type (tcase.off),
+                                  size_type (tcase.size));
             break;
 
         case Erase (iter):
diff --git a/tests/utilities/20.operators.cpp b/tests/utilities/20.operators.cpp
index 4f6101c..b93069a 100644
--- a/tests/utilities/20.operators.cpp
+++ b/tests/utilities/20.operators.cpp
@@ -397,9 +397,11 @@
 
     typedef RandomAccessIterator I;
 
-    typedef typename std::iterator_traits<I>::difference_type DiffT;
-
-    RandomNumberGenerator<DiffT> rndgen;
+#if !defined _RWSTD_NO_DEBUG_ITER
+    RandomNumberGenerator<typename I::difference_type> rndgen;
+#else
+    RandomNumberGenerator<T> rndgen;
+#endif
 
     std::random_shuffle (I (), I ());
     std::random_shuffle (I (), I (), rndgen);
diff --git a/util/gencat.cpp b/util/gencat.cpp
index 6bbfb8d..51bcc17 100644
--- a/util/gencat.cpp
+++ b/util/gencat.cpp
@@ -151,7 +151,7 @@
     cmd += rc_name;
     cmd += " -o ";
     cmd += res_name;
-    cmd += " && gcc -shared -o ";
+    cmd += " && gcc -shared -mno-cygwin -o ";
     cmd += dll_name;
     cmd += ' ';
     cmd += res_name;