OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc4/] [libstdc++-v3/] [doc/] [xml/] [manual/] [backwards_compatibility.xml] - Diff between revs 424 and 519

Only display areas with differences | Details | Blame | View Log

Rev 424 Rev 519
  
  
    
    
      ISO C++
      ISO C++
    
    
    
    
      backwards
      backwards
    
    
  
  
Backwards Compatibility
Backwards Compatibility
First
First
The first generation GNU C++ library was called libg++.  It was a
The first generation GNU C++ library was called libg++.  It was a
separate GNU project, although reliably paired with GCC. Rumors imply
separate GNU project, although reliably paired with GCC. Rumors imply
that it had a working relationship with at least two kinds of
that it had a working relationship with at least two kinds of
dinosaur.
dinosaur.
Some background: libg++ was designed and created when there was no
Some background: libg++ was designed and created when there was no
ISO standard to provide guidance.  Classes like linked lists are now
ISO standard to provide guidance.  Classes like linked lists are now
provided for by list<T> and do not need to be
provided for by list<T> and do not need to be
created by genclass.  (For that matter, templates exist
created by genclass.  (For that matter, templates exist
now and are well-supported, whereas genclass (mostly) predates them.)
now and are well-supported, whereas genclass (mostly) predates them.)
There are other classes in libg++ that are not specified in the
There are other classes in libg++ that are not specified in the
ISO Standard (e.g., statistical analysis).  While there are a lot of
ISO Standard (e.g., statistical analysis).  While there are a lot of
really useful things that are used by a lot of people, the Standards
really useful things that are used by a lot of people, the Standards
Committee couldn't include everything, and so a lot of those
Committee couldn't include everything, and so a lot of those
obvious classes didn't get included.
obvious classes didn't get included.
Known Issues include many of the limitations of its immediate ancestor.
Known Issues include many of the limitations of its immediate ancestor.
Portability notes and known implementation limitations are as follows.
Portability notes and known implementation limitations are as follows.
  No <code>ios_base</code>
  No <code>ios_base</code>
 At least some older implementations don't have std::ios_base, so you should use std::ios::badbit, std::ios::failbit and std::ios::eofbit and std::ios::goodbit.
 At least some older implementations don't have std::ios_base, so you should use std::ios::badbit, std::ios::failbit and std::ios::eofbit and std::ios::goodbit.
No <code>cout</code> in <code>ostream.h</code>, no <code>cin</code> in <code>istream.h</code>
No <code>cout</code> in <code>ostream.h</code>, no <code>cin</code> in <code>istream.h</code>
        In earlier versions of the standard,
        In earlier versions of the standard,
        fstream.h,
        fstream.h,
        ostream.h
        ostream.h
        and istream.h
        and istream.h
        used to define
        used to define
        cout, cin and so on. ISO C++ specifies that one needs to include
        cout, cin and so on. ISO C++ specifies that one needs to include
        iostream
        iostream
        explicitly to get the required definitions.
        explicitly to get the required definitions.
 
 
 Some include adjustment may be required.
 Some include adjustment may be required.
This project is no longer maintained or supported, and the sources
This project is no longer maintained or supported, and the sources
archived. For the desperate,
archived. For the desperate,
the GCC extensions
the GCC extensions
page describes where to find the last libg++ source. The code is
page describes where to find the last libg++ source. The code is
considered replaced and rewritten.
considered replaced and rewritten.
Second
Second
  The second generation GNU C++ library was called libstdc++, or
  The second generation GNU C++ library was called libstdc++, or
  libstdc++-v2. It spans the time between libg++ and pre-ISO C++
  libstdc++-v2. It spans the time between libg++ and pre-ISO C++
  standardization and is usually associated with the following GCC
  standardization and is usually associated with the following GCC
  releases: egcs 1.x, gcc 2.95, and gcc 2.96.
  releases: egcs 1.x, gcc 2.95, and gcc 2.96.
  The STL portions of this library are based on SGI/HP STL release 3.11.
  The STL portions of this library are based on SGI/HP STL release 3.11.
  This project is no longer maintained or supported, and the sources
  This project is no longer maintained or supported, and the sources
  archived.  The code is considered replaced and rewritten.
  archived.  The code is considered replaced and rewritten.
  Portability notes and known implementation limitations are as follows.
  Portability notes and known implementation limitations are as follows.
  Namespace <code>std::</code> not supported
  Namespace <code>std::</code> not supported
  
  
    Some care is required to support C++ compiler and or library
    Some care is required to support C++ compiler and or library
    implementation that do not have the standard library in
    implementation that do not have the standard library in
    namespace std.
    namespace std.
  
  
  
  
    The following sections list some possible solutions to support compilers
    The following sections list some possible solutions to support compilers
    that cannot ignore std::-qualified names.
    that cannot ignore std::-qualified names.
  
  
  
  
    First, see if the compiler has a flag for this. Namespace
    First, see if the compiler has a flag for this. Namespace
    back-portability-issues are generally not a problem for g++
    back-portability-issues are generally not a problem for g++
    compilers that do not have libstdc++ in std::, as the
    compilers that do not have libstdc++ in std::, as the
    compilers use -fno-honor-std (ignore
    compilers use -fno-honor-std (ignore
    std::, :: = std::) by default. That is,
    std::, :: = std::) by default. That is,
    the responsibility for enabling or disabling std:: is
    the responsibility for enabling or disabling std:: is
    on the user; the maintainer does not have to care about it. This
    on the user; the maintainer does not have to care about it. This
    probably applies to some other compilers as well.
    probably applies to some other compilers as well.
  
  
  
  
    Second, experiment with a variety of pre-processor tricks.
    Second, experiment with a variety of pre-processor tricks.
  
  
  
  
    By defining std as a macro, fully-qualified namespace
    By defining std as a macro, fully-qualified namespace
    calls become global. Volia.
    calls become global. Volia.
  
  
#ifdef WICKEDLY_OLD_COMPILER
#ifdef WICKEDLY_OLD_COMPILER
# define std
# define std
#endif
#endif
  
  
    Thanks to Juergen Heinzl who posted this solution on gnu.gcc.help.
    Thanks to Juergen Heinzl who posted this solution on gnu.gcc.help.
  
  
  
  
    Another pre-processor based approach is to define a macro
    Another pre-processor based approach is to define a macro
    NAMESPACE_STD, which is defined to either
    NAMESPACE_STD, which is defined to either
      or std based on a compile-type
      or std based on a compile-type
    test. On GNU systems, this can be done with autotools by means of
    test. On GNU systems, this can be done with autotools by means of
    an autoconf test (see below) for HAVE_NAMESPACE_STD,
    an autoconf test (see below) for HAVE_NAMESPACE_STD,
    then using that to set a value for the NAMESPACE_STD
    then using that to set a value for the NAMESPACE_STD
    macro.  At that point, one is able to use
    macro.  At that point, one is able to use
    NAMESPACE_STD::string, which will evaluate to
    NAMESPACE_STD::string, which will evaluate to
    std::string or ::string (i.e., in the
    std::string or ::string (i.e., in the
    global namespace on systems that do not put string in
    global namespace on systems that do not put string in
    std::).
    std::).
  
  
dnl @synopsis AC_CXX_NAMESPACE_STD
dnl @synopsis AC_CXX_NAMESPACE_STD
dnl
dnl
dnl If the compiler supports namespace std, define
dnl If the compiler supports namespace std, define
dnl HAVE_NAMESPACE_STD.
dnl HAVE_NAMESPACE_STD.
dnl
dnl
dnl @category Cxx
dnl @category Cxx
dnl @author Todd Veldhuizen
dnl @author Todd Veldhuizen
dnl @author Luc Maisonobe <luc@spaceroots.org>
dnl @author Luc Maisonobe <luc@spaceroots.org>
dnl @version 2004-02-04
dnl @version 2004-02-04
dnl @license AllPermissive
dnl @license AllPermissive
AC_DEFUN([AC_CXX_NAMESPACE_STD], [
AC_DEFUN([AC_CXX_NAMESPACE_STD], [
  AC_CACHE_CHECK(if g++ supports namespace std,
  AC_CACHE_CHECK(if g++ supports namespace std,
  ac_cv_cxx_have_std_namespace,
  ac_cv_cxx_have_std_namespace,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  AC_TRY_COMPILE([#include <iostream>
  AC_TRY_COMPILE([#include <iostream>
                  std::istream& is = std::cin;],,
                  std::istream& is = std::cin;],,
  ac_cv_cxx_have_std_namespace=yes, ac_cv_cxx_have_std_namespace=no)
  ac_cv_cxx_have_std_namespace=yes, ac_cv_cxx_have_std_namespace=no)
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_have_std_namespace" = yes; then
  if test "$ac_cv_cxx_have_std_namespace" = yes; then
    AC_DEFINE(HAVE_NAMESPACE_STD,,[Define if g++ supports namespace std. ])
    AC_DEFINE(HAVE_NAMESPACE_STD,,[Define if g++ supports namespace std. ])
  fi
  fi
])
])
Illegal iterator usage
Illegal iterator usage
  The following illustrate implementation-allowed illegal iterator
  The following illustrate implementation-allowed illegal iterator
  use, and then correct use.
  use, and then correct use.
  
  
    
    
      you cannot do ostream::operator<<(iterator)
      you cannot do ostream::operator<<(iterator)
      to print the address of the iterator => use
      to print the address of the iterator => use
      operator<< &*iterator instead
      operator<< &*iterator instead
    
    
  
  
  
  
    
    
      you cannot clear an iterator's reference (iterator =
      you cannot clear an iterator's reference (iterator =
      0) => use iterator = iterator_type();
      0) => use iterator = iterator_type();
    
    
  
  
  
  
    
    
      if (iterator) won't work any more => use
      if (iterator) won't work any more => use
      if (iterator != iterator_type())
      if (iterator != iterator_type())
    
    
  
  
  <code>isspace</code> from <filename class="headerfile">cctype</filename> is a macro</code></pre></td>
        <td class="diff"><pre><code>  <title><code>isspace</code> from <filename class="headerfile">cctype</filename> is a macro</code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>  
  
  
  
    Glibc 2.0.x and 2.1.x define 
    Glibc 2.0.x and 2.1.x define 
    class="headerfile">ctype.h functionality as macros
    class="headerfile">ctype.h functionality as macros
    (isspace, isalpha etc.).
    (isspace, isalpha etc.).
  
  
  
  
    This implementations of libstdc++, however, keep these functions
    This implementations of libstdc++, however, keep these functions
    as macros, and so it is not back-portable to use fully qualified
    as macros, and so it is not back-portable to use fully qualified
    names. For example:
    names. For example:
  
  
#include <cctype>
#include <cctype>
int main() { std::isspace('X'); }
int main() { std::isspace('X'); }
  Results in something like this:
  Results in something like this:
std:: (__ctype_b[(int) ( ( 'X' ) )] & (unsigned short int) _ISspace ) ;
std:: (__ctype_b[(int) ( ( 'X' ) )] & (unsigned short int) _ISspace ) ;
  A solution is to modify a header-file so that the compiler tells
  A solution is to modify a header-file so that the compiler tells
  ctype.h to define functions
  ctype.h to define functions
  instead of macros:
  instead of macros:
// This keeps isalnum, et al from being propagated as macros.
// This keeps isalnum, et al from being propagated as macros.
#if __linux__
#if __linux__
# define __NO_CTYPE 1
# define __NO_CTYPE 1
#endif
#endif
  Then, include ctype.h
  Then, include ctype.h
  Another problem arises if you put a using namespace
  Another problem arises if you put a using namespace
  std; declaration at the top, and include 
  std; declaration at the top, and include 
  class="headerfile">ctype.h. This will result in
  class="headerfile">ctype.h. This will result in
  ambiguities between the definitions in the global namespace
  ambiguities between the definitions in the global namespace
  (ctype.h) and the
  (ctype.h) and the
  definitions in namespace std::
  definitions in namespace std::
  (<cctype>).
  (<cctype>).
No <code>vector::at</code>, <code>deque::at</code>, <code>string::at</code>
No <code>vector::at</code>, <code>deque::at</code>, <code>string::at</code>
  One solution is to add an autoconf-test for this:
  One solution is to add an autoconf-test for this:
AC_MSG_CHECKING(for container::at)
AC_MSG_CHECKING(for container::at)
AC_TRY_COMPILE(
AC_TRY_COMPILE(
[
[
#include <vector>
#include <vector>
#include <deque>
#include <deque>
#include <string>
#include <string>
using namespace std;
using namespace std;
],
],
[
[
deque<int> test_deque(3);
deque<int> test_deque(3);
test_deque.at(2);
test_deque.at(2);
vector<int> test_vector(2);
vector<int> test_vector(2);
test_vector.at(1);
test_vector.at(1);
string test_string(test_string);
string test_string(test_string);
test_string.at(3);
test_string.at(3);
],
],
[AC_MSG_RESULT(yes)
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CONTAINER_AT)],
AC_DEFINE(HAVE_CONTAINER_AT)],
[AC_MSG_RESULT(no)])
[AC_MSG_RESULT(no)])
  If you are using other (non-GNU) compilers it might be a good idea
  If you are using other (non-GNU) compilers it might be a good idea
  to check for string::at separately.
  to check for string::at separately.
No <code>std::char_traits<char>::eof</code>
No <code>std::char_traits<char>::eof</code>
  Use some kind of autoconf test, plus this:
  Use some kind of autoconf test, plus this:
#ifdef HAVE_CHAR_TRAITS
#ifdef HAVE_CHAR_TRAITS
#define CPP_EOF std::char_traits<char>::eof()
#define CPP_EOF std::char_traits<char>::eof()
#else
#else
#define CPP_EOF EOF
#define CPP_EOF EOF
#endif
#endif
No <code>string::clear</code>
No <code>string::clear</code>
  There are two functions for deleting the contents of a string:
  There are two functions for deleting the contents of a string:
  clear and erase (the latter returns the
  clear and erase (the latter returns the
  string).
  string).
void
void
clear() { _M_mutate(0, this->size(), 0); }
clear() { _M_mutate(0, this->size(), 0); }
basic_string&
basic_string&
erase(size_type __pos = 0, size_type __n = npos)
erase(size_type __pos = 0, size_type __n = npos)
{
{
  return this->replace(_M_check(__pos), _M_fold(__pos, __n),
  return this->replace(_M_check(__pos), _M_fold(__pos, __n),
                          _M_data(), _M_data());
                          _M_data(), _M_data());
}
}
  Unfortunately, clear is not implemented in this
  Unfortunately, clear is not implemented in this
  version, so you should use erase (which is probably
  version, so you should use erase (which is probably
  faster than operator=(charT*)).
  faster than operator=(charT*)).
</code></pre></td>
        <td class="diff"><pre><code><title></code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>  Removal of <code>ostream::form</code> and <code>istream::scan</code></code></pre></td>
        <td class="diff"><pre><code>  Removal of <code>ostream::form</code> and <code>istream::scan</code></code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>  extensions</code></pre></td>
        <td class="diff"><pre><code>  extensions</code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>
  These are no longer supported. Please use stringstreams instead.
  These are no longer supported. Please use stringstreams instead.
No <code>basic_stringbuf</code>, <code>basic_stringstream</code>
No <code>basic_stringbuf</code>, <code>basic_stringstream</code>
  Although the ISO standard i/ostringstream-classes are
  Although the ISO standard i/ostringstream-classes are
  provided, (sstream), for
  provided, (sstream), for
  compatibility with older implementations the pre-ISO
  compatibility with older implementations the pre-ISO
  i/ostrstream (
  i/ostrstream (
  class="headerfile">strstream) interface is also provided,
  class="headerfile">strstream) interface is also provided,
  with these caveats:
  with these caveats:
  
  
    
    
      strstream is considered to be deprecated
      strstream is considered to be deprecated
    
    
  
  
  
  
    
    
      strstream is limited to char
      strstream is limited to char
    
    
  
  
  
  
    
    
      with ostringstream you don't have to take care of
      with ostringstream you don't have to take care of
      terminating the string or freeing its memory
      terminating the string or freeing its memory
    
    
  
  
  
  
    
    
      istringstream can be re-filled (clear();
      istringstream can be re-filled (clear();
      str(input);)
      str(input);)
    
    
  
  
  You can then use output-stringstreams like this:
  You can then use output-stringstreams like this:
#ifdef HAVE_SSTREAM
#ifdef HAVE_SSTREAM
# include <sstream>
# include <sstream>
#else
#else
# include <strstream>
# include <strstream>
#endif
#endif
#ifdef HAVE_SSTREAM
#ifdef HAVE_SSTREAM
  std::ostringstream oss;
  std::ostringstream oss;
#else
#else
  std::ostrstream oss;
  std::ostrstream oss;
#endif
#endif
oss << Name= << m_name << , number= << m_number << std::endl;
oss << Name= << m_name << , number= << m_number << std::endl;
...
...
#ifndef HAVE_SSTREAM
#ifndef HAVE_SSTREAM
  oss << std::ends; // terminate the char*-string
  oss << std::ends; // terminate the char*-string
#endif
#endif
// str() returns char* for ostrstream and a string for ostringstream
// str() returns char* for ostrstream and a string for ostringstream
// this also causes ostrstream to think that the buffer's memory
// this also causes ostrstream to think that the buffer's memory
// is yours
// is yours
m_label.set_text(oss.str());
m_label.set_text(oss.str());
#ifndef HAVE_SSTREAM
#ifndef HAVE_SSTREAM
  // let the ostrstream take care of freeing the memory
  // let the ostrstream take care of freeing the memory
  oss.freeze(false);
  oss.freeze(false);
#endif
#endif
      Input-stringstreams can be used similarly:
      Input-stringstreams can be used similarly:
std::string input;
std::string input;
...
...
#ifdef HAVE_SSTREAM
#ifdef HAVE_SSTREAM
std::istringstream iss(input);
std::istringstream iss(input);
#else
#else
std::istrstream iss(input.c_str());
std::istrstream iss(input.c_str());
#endif
#endif
int i;
int i;
iss >> i;
iss >> i;
 One (the only?) restriction is that an istrstream cannot be re-filled:
 One (the only?) restriction is that an istrstream cannot be re-filled:
std::istringstream iss(numerator);
std::istringstream iss(numerator);
iss >> m_num;
iss >> m_num;
// this is not possible with istrstream
// this is not possible with istrstream
iss.clear();
iss.clear();
iss.str(denominator);
iss.str(denominator);
iss >> m_den;
iss >> m_den;
If you don't care about speed, you can put these conversions in
If you don't care about speed, you can put these conversions in
      a template-function:
      a template-function:
template <class X>
template <class X>
void fromString(const string& input, X& any)
void fromString(const string& input, X& any)
{
{
#ifdef HAVE_SSTREAM
#ifdef HAVE_SSTREAM
std::istringstream iss(input);
std::istringstream iss(input);
#else
#else
std::istrstream iss(input.c_str());
std::istrstream iss(input.c_str());
#endif
#endif
X temp;
X temp;
iss >> temp;
iss >> temp;
if (iss.fail())
if (iss.fail())
throw runtime_error(..)
throw runtime_error(..)
any = temp;
any = temp;
}
}
  Another example of using stringstreams is in 
  Another example of using stringstreams is in 
  linkend="strings.string.shrink">this howto.
  linkend="strings.string.shrink">this howto.
 There is additional information in the libstdc++-v2 info files, in
 There is additional information in the libstdc++-v2 info files, in
particular info iostream.
particular info iostream.
  Little or no wide character support
  Little or no wide character support
  
  
    Classes wstring and
    Classes wstring and
    char_traits<wchar_t> are
    char_traits<wchar_t> are
    not supported.
    not supported.
  
  
  No templatized iostreams
  No templatized iostreams
  
  
    Classes wfilebuf and
    Classes wfilebuf and
    wstringstream are not supported.
    wstringstream are not supported.
  
  
Thread safety issues
Thread safety issues
  
  
    Earlier GCC releases had a somewhat different approach to
    Earlier GCC releases had a somewhat different approach to
    threading configuration and proper compilation.  Before GCC 3.0,
    threading configuration and proper compilation.  Before GCC 3.0,
    configuration of the threading model was dictated by compiler
    configuration of the threading model was dictated by compiler
    command-line options and macros (both of which were somewhat
    command-line options and macros (both of which were somewhat
    thread-implementation and port-specific).  There were no
    thread-implementation and port-specific).  There were no
    guarantees related to being able to link code compiled with one
    guarantees related to being able to link code compiled with one
    set of options and macro setting with another set.
    set of options and macro setting with another set.
  
  
  
  
    For GCC 3.0, configuration of the threading model used with
    For GCC 3.0, configuration of the threading model used with
    libraries and user-code is performed when GCC is configured and
    libraries and user-code is performed when GCC is configured and
    built using the --enable-threads and --disable-threads options.
    built using the --enable-threads and --disable-threads options.
    The ABI is stable for symbol name-mangling and limited functional
    The ABI is stable for symbol name-mangling and limited functional
    compatibility exists between code compiled under different
    compatibility exists between code compiled under different
    threading models.
    threading models.
  
  
   
   
     The libstdc++ library has been designed so that it can be used in
     The libstdc++ library has been designed so that it can be used in
     multithreaded applications (with libstdc++-v2 this was only true
     multithreaded applications (with libstdc++-v2 this was only true
     of the STL parts.)  The first problem is finding a
     of the STL parts.)  The first problem is finding a
     fast method of implementation portable to
     fast method of implementation portable to
     all platforms.  Due to historical reasons, some of the library is
     all platforms.  Due to historical reasons, some of the library is
     written against per-CPU-architecture spinlocks and other parts
     written against per-CPU-architecture spinlocks and other parts
     against the gthr.h abstraction layer which is provided by gcc.  A
     against the gthr.h abstraction layer which is provided by gcc.  A
     minor problem that pops up every so often is different
     minor problem that pops up every so often is different
     interpretations of what "thread-safe" means for a
     interpretations of what "thread-safe" means for a
     library (not a general program).  We currently use the 
     library (not a general program).  We currently use the 
     url="http://www.sgi.com/tech/stl/thread_safety.html">same
     url="http://www.sgi.com/tech/stl/thread_safety.html">same
     definition that SGI uses for their STL subset.  However,
     definition that SGI uses for their STL subset.  However,
     the exception for read-only containers only applies to the STL
     the exception for read-only containers only applies to the STL
     components. This definition is widely-used and something similar
     components. This definition is widely-used and something similar
     will be used in the next version of the C++ standard library.
     will be used in the next version of the C++ standard library.
   
   
   
   
     Here is a small link farm to threads (no pun) in the mail
     Here is a small link farm to threads (no pun) in the mail
     archives that discuss the threading problem.  Each link is to the
     archives that discuss the threading problem.  Each link is to the
     first relevant message in the thread; from there you can use
     first relevant message in the thread; from there you can use
     "Thread Next" to move down the thread.  This farm is in
     "Thread Next" to move down the thread.  This farm is in
     latest-to-oldest order.
     latest-to-oldest order.
   
   
      
      
        
        
          
          
            Our threading expert Loren gives a breakdown of 
            Our threading expert Loren gives a breakdown of 
            url="http://gcc.gnu.org/ml/libstdc++/2001-10/msg00024.html">the
            url="http://gcc.gnu.org/ml/libstdc++/2001-10/msg00024.html">the
            six situations involving threads for the 3.0
            six situations involving threads for the 3.0
            release series.
            release series.
          
          
      
      
        
        
          
          
            
            
        This message inspired a recent updating of issues with
        This message inspired a recent updating of issues with
        threading and the SGI STL library.  It also contains some
        threading and the SGI STL library.  It also contains some
        example POSIX-multithreaded STL code.
        example POSIX-multithreaded STL code.
          
          
        
        
      
      
   
   
     (A large selection of links to older messages has been removed;
     (A large selection of links to older messages has been removed;
     many of the messages from 1999 were lost in a disk crash, and the
     many of the messages from 1999 were lost in a disk crash, and the
     few people with access to the backup tapes have been too swamped
     few people with access to the backup tapes have been too swamped
     with work to restore them.  Many of the points have been
     with work to restore them.  Many of the points have been
     superseded anyhow.)
     superseded anyhow.)
   
   
Third
Third
 The third generation GNU C++ library is called libstdc++, or
 The third generation GNU C++ library is called libstdc++, or
libstdc++-v3.
libstdc++-v3.
      The subset commonly known as the Standard Template Library
      The subset commonly known as the Standard Template Library
         (chapters 23 through 25, mostly) is adapted from the final release
         (chapters 23 through 25, mostly) is adapted from the final release
         of the SGI STL (version 3.3), with extensive changes.
         of the SGI STL (version 3.3), with extensive changes.
      
      
      A more formal description of the V3 goals can be found in the
      A more formal description of the V3 goals can be found in the
         official design document.
         official design document.
      
      
Portability notes and known implementation limitations are as follows.
Portability notes and known implementation limitations are as follows.
Pre-ISO headers moved to backwards or removed
Pre-ISO headers moved to backwards or removed
 The pre-ISO C++ headers
 The pre-ISO C++ headers
      (iostream.h, defalloc.h etc.) are
      (iostream.h, defalloc.h etc.) are
      available, unlike previous libstdc++ versions, but inclusion
      available, unlike previous libstdc++ versions, but inclusion
      generates a warning that you are using deprecated headers.
      generates a warning that you are using deprecated headers.
    This compatibility layer is constructed by including the
    This compatibility layer is constructed by including the
    standard C++ headers, and injecting any items in
    standard C++ headers, and injecting any items in
    std:: into the global namespace.
    std:: into the global namespace.
   
   
   For those of you new to ISO C++ (welcome, time travelers!), no,
   For those of you new to ISO C++ (welcome, time travelers!), no,
      that isn't a typo. Yes, the headers really have new names.
      that isn't a typo. Yes, the headers really have new names.
      Marshall Cline's C++ FAQ Lite has a good explanation in item
      Marshall Cline's C++ FAQ Lite has a good explanation in item
      [27.4].
      [27.4].
   
   
 Some include adjustment may be required. What follows is an
 Some include adjustment may be required. What follows is an
autoconf test that defines PRE_STDCXX_HEADERS when they
autoconf test that defines PRE_STDCXX_HEADERS when they
exist.
exist.
# AC_HEADER_PRE_STDCXX
# AC_HEADER_PRE_STDCXX
AC_DEFUN([AC_HEADER_PRE_STDCXX], [
AC_DEFUN([AC_HEADER_PRE_STDCXX], [
  AC_CACHE_CHECK(for pre-ISO C++ include files,
  AC_CACHE_CHECK(for pre-ISO C++ include files,
  ac_cv_cxx_pre_stdcxx,
  ac_cv_cxx_pre_stdcxx,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  ac_save_CXXFLAGS="$CXXFLAGS"
  ac_save_CXXFLAGS="$CXXFLAGS"
  CXXFLAGS="$CXXFLAGS -Wno-deprecated"
  CXXFLAGS="$CXXFLAGS -Wno-deprecated"
  # Omit defalloc.h, as compilation with newer compilers is problematic.
  # Omit defalloc.h, as compilation with newer compilers is problematic.
  AC_TRY_COMPILE([
  AC_TRY_COMPILE([
  #include <new.h>
  #include <new.h>
  #include <iterator.h>
  #include <iterator.h>
  #include <alloc.h>
  #include <alloc.h>
  #include <set.h>
  #include <set.h>
  #include <hashtable.h>
  #include <hashtable.h>
  #include <hash_set.h>
  #include <hash_set.h>
  #include <fstream.h>
  #include <fstream.h>
  #include <tempbuf.h>
  #include <tempbuf.h>
  #include <istream.h>
  #include <istream.h>
  #include <bvector.h>
  #include <bvector.h>
  #include <stack.h>
  #include <stack.h>
  #include <rope.h>
  #include <rope.h>
  #include <complex.h>
  #include <complex.h>
  #include <ostream.h>
  #include <ostream.h>
  #include <heap.h>
  #include <heap.h>
  #include <iostream.h>
  #include <iostream.h>
  #include <function.h>
  #include <function.h>
  #include <multimap.h>
  #include <multimap.h>
  #include <pair.h>
  #include <pair.h>
  #include <stream.h>
  #include <stream.h>
  #include <iomanip.h>
  #include <iomanip.h>
  #include <slist.h>
  #include <slist.h>
  #include <tree.h>
  #include <tree.h>
  #include <vector.h>
  #include <vector.h>
  #include <deque.h>
  #include <deque.h>
  #include <multiset.h>
  #include <multiset.h>
  #include <list.h>
  #include <list.h>
  #include <map.h>
  #include <map.h>
  #include <algobase.h>
  #include <algobase.h>
  #include <hash_map.h>
  #include <hash_map.h>
  #include <algo.h>
  #include <algo.h>
  #include <queue.h>
  #include <queue.h>
  #include <streambuf.h>
  #include <streambuf.h>
  ],,
  ],,
  ac_cv_cxx_pre_stdcxx=yes, ac_cv_cxx_pre_stdcxx=no)
  ac_cv_cxx_pre_stdcxx=yes, ac_cv_cxx_pre_stdcxx=no)
  CXXFLAGS="$ac_save_CXXFLAGS"
  CXXFLAGS="$ac_save_CXXFLAGS"
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_pre_stdcxx" = yes; then
  if test "$ac_cv_cxx_pre_stdcxx" = yes; then
    AC_DEFINE(PRE_STDCXX_HEADERS,,[Define if pre-ISO C++ header files are present. ])
    AC_DEFINE(PRE_STDCXX_HEADERS,,[Define if pre-ISO C++ header files are present. ])
  fi
  fi
])
])
Porting between pre-ISO headers and ISO headers is simple: headers
Porting between pre-ISO headers and ISO headers is simple: headers
like vector.h can be replaced with vector and a using
like vector.h can be replaced with vector and a using
directive using namespace std; can be put at the global
directive using namespace std; can be put at the global
scope. This should be enough to get this code compiling, assuming the
scope. This should be enough to get this code compiling, assuming the
other usage is correct.
other usage is correct.
Extension headers hash_map, hash_set moved to ext or backwards
Extension headers hash_map, hash_set moved to ext or backwards
      At this time most of the features of the SGI STL extension have been
      At this time most of the features of the SGI STL extension have been
         replaced by standardized libraries.
         replaced by standardized libraries.
         In particular, the unordered_map and unordered_set containers of TR1
         In particular, the unordered_map and unordered_set containers of TR1
         are suitable replacement for the non-standard hash_map and hash_set
         are suitable replacement for the non-standard hash_map and hash_set
         containers in the SGI STL.
         containers in the SGI STL.
      
      
 Header files hash_map and hash_set moved
 Header files hash_map and hash_set moved
to ext/hash_map and  ext/hash_set,
to ext/hash_map and  ext/hash_set,
respectively. At the same time, all types in these files are enclosed
respectively. At the same time, all types in these files are enclosed
in namespace __gnu_cxx. Later versions move deprecate
in namespace __gnu_cxx. Later versions move deprecate
these files, and suggest using TR1's  unordered_map
these files, and suggest using TR1's  unordered_map
and  unordered_set instead.
and  unordered_set instead.
      The extensions are no longer in the global or std
      The extensions are no longer in the global or std
         namespaces, instead they are declared in the __gnu_cxx
         namespaces, instead they are declared in the __gnu_cxx
         namespace. For maximum portability, consider defining a namespace
         namespace. For maximum portability, consider defining a namespace
         alias to use to talk about extensions, e.g.:
         alias to use to talk about extensions, e.g.:
      
      
      
      
      #ifdef __GNUC__
      #ifdef __GNUC__
      #if __GNUC__ < 3
      #if __GNUC__ < 3
        #include <hash_map.h>
        #include <hash_map.h>
        namespace extension { using ::hash_map; }; // inherit globals
        namespace extension { using ::hash_map; }; // inherit globals
      #else
      #else
        #include <backward/hash_map>
        #include <backward/hash_map>
        #if __GNUC__ == 3 && __GNUC_MINOR__ == 0
        #if __GNUC__ == 3 && __GNUC_MINOR__ == 0
          namespace extension = std;               // GCC 3.0
          namespace extension = std;               // GCC 3.0
        #else
        #else
          namespace extension = ::__gnu_cxx;       // GCC 3.1 and later
          namespace extension = ::__gnu_cxx;       // GCC 3.1 and later
        #endif
        #endif
      #endif
      #endif
      #else      // ...  there are other compilers, right?
      #else      // ...  there are other compilers, right?
        namespace extension = std;
        namespace extension = std;
      #endif
      #endif
      extension::hash_map<int,int> my_map;
      extension::hash_map<int,int> my_map;
      
      
      This is a bit cleaner than defining typedefs for all the
      This is a bit cleaner than defining typedefs for all the
         instantiations you might need.
         instantiations you might need.
      
      
The following autoconf tests check for working HP/SGI hash containers.
The following autoconf tests check for working HP/SGI hash containers.
# AC_HEADER_EXT_HASH_MAP
# AC_HEADER_EXT_HASH_MAP
AC_DEFUN([AC_HEADER_EXT_HASH_MAP], [
AC_DEFUN([AC_HEADER_EXT_HASH_MAP], [
  AC_CACHE_CHECK(for ext/hash_map,
  AC_CACHE_CHECK(for ext/hash_map,
  ac_cv_cxx_ext_hash_map,
  ac_cv_cxx_ext_hash_map,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  ac_save_CXXFLAGS="$CXXFLAGS"
  ac_save_CXXFLAGS="$CXXFLAGS"
  CXXFLAGS="$CXXFLAGS -Werror"
  CXXFLAGS="$CXXFLAGS -Werror"
  AC_TRY_COMPILE([#include <ext/hash_map>], [using __gnu_cxx::hash_map;],
  AC_TRY_COMPILE([#include <ext/hash_map>], [using __gnu_cxx::hash_map;],
  ac_cv_cxx_ext_hash_map=yes, ac_cv_cxx_ext_hash_map=no)
  ac_cv_cxx_ext_hash_map=yes, ac_cv_cxx_ext_hash_map=no)
  CXXFLAGS="$ac_save_CXXFLAGS"
  CXXFLAGS="$ac_save_CXXFLAGS"
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_ext_hash_map" = yes; then
  if test "$ac_cv_cxx_ext_hash_map" = yes; then
    AC_DEFINE(HAVE_EXT_HASH_MAP,,[Define if ext/hash_map is present. ])
    AC_DEFINE(HAVE_EXT_HASH_MAP,,[Define if ext/hash_map is present. ])
  fi
  fi
])
])
# AC_HEADER_EXT_HASH_SET
# AC_HEADER_EXT_HASH_SET
AC_DEFUN([AC_HEADER_EXT_HASH_SET], [
AC_DEFUN([AC_HEADER_EXT_HASH_SET], [
  AC_CACHE_CHECK(for ext/hash_set,
  AC_CACHE_CHECK(for ext/hash_set,
  ac_cv_cxx_ext_hash_set,
  ac_cv_cxx_ext_hash_set,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  ac_save_CXXFLAGS="$CXXFLAGS"
  ac_save_CXXFLAGS="$CXXFLAGS"
  CXXFLAGS="$CXXFLAGS -Werror"
  CXXFLAGS="$CXXFLAGS -Werror"
  AC_TRY_COMPILE([#include <ext/hash_set>], [using __gnu_cxx::hash_set;],
  AC_TRY_COMPILE([#include <ext/hash_set>], [using __gnu_cxx::hash_set;],
  ac_cv_cxx_ext_hash_set=yes, ac_cv_cxx_ext_hash_set=no)
  ac_cv_cxx_ext_hash_set=yes, ac_cv_cxx_ext_hash_set=no)
  CXXFLAGS="$ac_save_CXXFLAGS"
  CXXFLAGS="$ac_save_CXXFLAGS"
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_ext_hash_set" = yes; then
  if test "$ac_cv_cxx_ext_hash_set" = yes; then
    AC_DEFINE(HAVE_EXT_HASH_SET,,[Define if ext/hash_set is present. ])
    AC_DEFINE(HAVE_EXT_HASH_SET,,[Define if ext/hash_set is present. ])
  fi
  fi
])
])
No <code>ios::nocreate/ios::noreplace</code>.</code></pre></td>
        <td class="diff"><pre><code><title>No <code>ios::nocreate/ios::noreplace</code>.</code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>
 The existence of ios::nocreate being used for
 The existence of ios::nocreate being used for
input-streams has been confirmed, most probably because the author
input-streams has been confirmed, most probably because the author
thought it would be more correct to specify nocreate explicitly.  So
thought it would be more correct to specify nocreate explicitly.  So
it can be left out for input-streams.
it can be left out for input-streams.
For output streams, nocreate is probably the default,
For output streams, nocreate is probably the default,
unless you specify std::ios::trunc ? To be safe, you can
unless you specify std::ios::trunc ? To be safe, you can
open the file for reading, check if it has been opened, and then
open the file for reading, check if it has been opened, and then
decide whether you want to create/replace or not. To my knowledge,
decide whether you want to create/replace or not. To my knowledge,
even older implementations support app, ate
even older implementations support app, ate
and trunc (except for app ?).
and trunc (except for app ?).
</code></pre></td>
        <td class="diff"><pre><code><title></code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>No <code>stream::attach(int fd)</code></code></pre></td>
        <td class="diff"><pre><code>No <code>stream::attach(int fd)</code></code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>
      Phil Edwards writes: It was considered and rejected for the ISO
      Phil Edwards writes: It was considered and rejected for the ISO
      standard.  Not all environments use file descriptors.  Of those
      standard.  Not all environments use file descriptors.  Of those
      that do, not all of them use integers to represent them.
      that do, not all of them use integers to represent them.
    
    
      For a portable solution (among systems which use
      For a portable solution (among systems which use
      file descriptors), you need to implement a subclass of
      file descriptors), you need to implement a subclass of
      std::streambuf (or
      std::streambuf (or
      std::basic_streambuf<..>) which opens a file
      std::basic_streambuf<..>) which opens a file
      given a descriptor, and then pass an instance of this to the
      given a descriptor, and then pass an instance of this to the
      stream-constructor.
      stream-constructor.
    
    
      An extension is available that implements this.
      An extension is available that implements this.
      ext/stdio_filebuf.h contains a derived class called
      ext/stdio_filebuf.h contains a derived class called
      __gnu_cxx::stdio_filebuf.
      __gnu_cxx::stdio_filebuf.
      This class can be constructed from a C FILE* or a file
      This class can be constructed from a C FILE* or a file
      descriptor, and provides the fd() function.
      descriptor, and provides the fd() function.
    
    
 For another example of this, refer to
 For another example of this, refer to
      fdstream example
      fdstream example
      by Nicolai Josuttis.
      by Nicolai Josuttis.
</code></pre></td>
        <td class="diff"><pre><code><title></code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>Support for C++98 dialect.</code></pre></td>
        <td class="diff"><pre><code>Support for C++98 dialect.</code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>
Check for complete library coverage of the C++1998/2003 standard.
Check for complete library coverage of the C++1998/2003 standard.
# AC_HEADER_STDCXX_98
# AC_HEADER_STDCXX_98
AC_DEFUN([AC_HEADER_STDCXX_98], [
AC_DEFUN([AC_HEADER_STDCXX_98], [
  AC_CACHE_CHECK(for ISO C++ 98 include files,
  AC_CACHE_CHECK(for ISO C++ 98 include files,
  ac_cv_cxx_stdcxx_98,
  ac_cv_cxx_stdcxx_98,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  AC_TRY_COMPILE([
  AC_TRY_COMPILE([
    #include <cassert>
    #include <cassert>
    #include <cctype>
    #include <cctype>
    #include <cerrno>
    #include <cerrno>
    #include <cfloat>
    #include <cfloat>
    #include <ciso646>
    #include <ciso646>
    #include <climits>
    #include <climits>
    #include <clocale>
    #include <clocale>
    #include <cmath>
    #include <cmath>
    #include <csetjmp>
    #include <csetjmp>
    #include <csignal>
    #include <csignal>
    #include <cstdarg>
    #include <cstdarg>
    #include <cstddef>
    #include <cstddef>
    #include <cstdio>
    #include <cstdio>
    #include <cstdlib>
    #include <cstdlib>
    #include <cstring>
    #include <cstring>
    #include <ctime>
    #include <ctime>
    #include <algorithm>
    #include <algorithm>
    #include <bitset>
    #include <bitset>
    #include <complex>
    #include <complex>
    #include <deque>
    #include <deque>
    #include <exception>
    #include <exception>
    #include <fstream>
    #include <fstream>
    #include <functional>
    #include <functional>
    #include <iomanip>
    #include <iomanip>
    #include <ios>
    #include <ios>
    #include <iosfwd>
    #include <iosfwd>
    #include <iostream>
    #include <iostream>
    #include <istream>
    #include <istream>
    #include <iterator>
    #include <iterator>
    #include <limits>
    #include <limits>
    #include <list>
    #include <list>
    #include <locale>
    #include <locale>
    #include <map>
    #include <map>
    #include <memory>
    #include <memory>
    #include <new>
    #include <new>
    #include <numeric>
    #include <numeric>
    #include <ostream>
    #include <ostream>
    #include <queue>
    #include <queue>
    #include <set>
    #include <set>
    #include <sstream>
    #include <sstream>
    #include <stack>
    #include <stack>
    #include <stdexcept>
    #include <stdexcept>
    #include <streambuf>
    #include <streambuf>
    #include <string>
    #include <string>
    #include <typeinfo>
    #include <typeinfo>
    #include <utility>
    #include <utility>
    #include <valarray>
    #include <valarray>
    #include <vector>
    #include <vector>
  ],,
  ],,
  ac_cv_cxx_stdcxx_98=yes, ac_cv_cxx_stdcxx_98=no)
  ac_cv_cxx_stdcxx_98=yes, ac_cv_cxx_stdcxx_98=no)
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_stdcxx_98" = yes; then
  if test "$ac_cv_cxx_stdcxx_98" = yes; then
    AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ])
    AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ])
  fi
  fi
])
])
</code></pre></td>
        <td class="diff"><pre><code><title></code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>Support for C++TR1 dialect.</code></pre></td>
        <td class="diff"><pre><code>Support for C++TR1 dialect.</code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>
Check for library coverage of the TR1 standard.
Check for library coverage of the TR1 standard.
# AC_HEADER_STDCXX_TR1
# AC_HEADER_STDCXX_TR1
AC_DEFUN([AC_HEADER_STDCXX_TR1], [
AC_DEFUN([AC_HEADER_STDCXX_TR1], [
  AC_CACHE_CHECK(for ISO C++ TR1 include files,
  AC_CACHE_CHECK(for ISO C++ TR1 include files,
  ac_cv_cxx_stdcxx_tr1,
  ac_cv_cxx_stdcxx_tr1,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  AC_TRY_COMPILE([
  AC_TRY_COMPILE([
  #include <tr1/array>
  #include <tr1/array>
  #include <tr1/ccomplex>
  #include <tr1/ccomplex>
  #include <tr1/cctype>
  #include <tr1/cctype>
  #include <tr1/cfenv>
  #include <tr1/cfenv>
  #include <tr1/cfloat>
  #include <tr1/cfloat>
  #include <tr1/cinttypes>
  #include <tr1/cinttypes>
  #include <tr1/climits>
  #include <tr1/climits>
  #include <tr1/cmath>
  #include <tr1/cmath>
  #include <tr1/complex>
  #include <tr1/complex>
  #include <tr1/cstdarg>
  #include <tr1/cstdarg>
  #include <tr1/cstdbool>
  #include <tr1/cstdbool>
  #include <tr1/cstdint>
  #include <tr1/cstdint>
  #include <tr1/cstdio>
  #include <tr1/cstdio>
  #include <tr1/cstdlib>
  #include <tr1/cstdlib>
  #include <tr1/ctgmath>
  #include <tr1/ctgmath>
  #include <tr1/ctime>
  #include <tr1/ctime>
  #include <tr1/cwchar>
  #include <tr1/cwchar>
  #include <tr1/cwctype>
  #include <tr1/cwctype>
  #include <tr1/functional>
  #include <tr1/functional>
  #include <tr1/memory>
  #include <tr1/memory>
  #include <tr1/random>
  #include <tr1/random>
  #include <tr1/regex>
  #include <tr1/regex>
  #include <tr1/tuple>
  #include <tr1/tuple>
  #include <tr1/type_traits>
  #include <tr1/type_traits>
  #include <tr1/unordered_set>
  #include <tr1/unordered_set>
  #include <tr1/unordered_map>
  #include <tr1/unordered_map>
  #include <tr1/utility>
  #include <tr1/utility>
  ],,
  ],,
  ac_cv_cxx_stdcxx_tr1=yes, ac_cv_cxx_stdcxx_tr1=no)
  ac_cv_cxx_stdcxx_tr1=yes, ac_cv_cxx_stdcxx_tr1=no)
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_stdcxx_tr1" = yes; then
  if test "$ac_cv_cxx_stdcxx_tr1" = yes; then
    AC_DEFINE(STDCXX_TR1_HEADERS,,[Define if ISO C++ TR1 header files are present. ])
    AC_DEFINE(STDCXX_TR1_HEADERS,,[Define if ISO C++ TR1 header files are present. ])
  fi
  fi
])
])
An alternative is to check just for specific TR1 includes, such as <unordered_map> and <unordered_set>.
An alternative is to check just for specific TR1 includes, such as <unordered_map> and <unordered_set>.
# AC_HEADER_TR1_UNORDERED_MAP
# AC_HEADER_TR1_UNORDERED_MAP
AC_DEFUN([AC_HEADER_TR1_UNORDERED_MAP], [
AC_DEFUN([AC_HEADER_TR1_UNORDERED_MAP], [
  AC_CACHE_CHECK(for tr1/unordered_map,
  AC_CACHE_CHECK(for tr1/unordered_map,
  ac_cv_cxx_tr1_unordered_map,
  ac_cv_cxx_tr1_unordered_map,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  AC_TRY_COMPILE([#include <tr1/unordered_map>], [using std::tr1::unordered_map;],
  AC_TRY_COMPILE([#include <tr1/unordered_map>], [using std::tr1::unordered_map;],
  ac_cv_cxx_tr1_unordered_map=yes, ac_cv_cxx_tr1_unordered_map=no)
  ac_cv_cxx_tr1_unordered_map=yes, ac_cv_cxx_tr1_unordered_map=no)
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_tr1_unordered_map" = yes; then
  if test "$ac_cv_cxx_tr1_unordered_map" = yes; then
    AC_DEFINE(HAVE_TR1_UNORDERED_MAP,,[Define if tr1/unordered_map is present. ])
    AC_DEFINE(HAVE_TR1_UNORDERED_MAP,,[Define if tr1/unordered_map is present. ])
  fi
  fi
])
])
# AC_HEADER_TR1_UNORDERED_SET
# AC_HEADER_TR1_UNORDERED_SET
AC_DEFUN([AC_HEADER_TR1_UNORDERED_SET], [
AC_DEFUN([AC_HEADER_TR1_UNORDERED_SET], [
  AC_CACHE_CHECK(for tr1/unordered_set,
  AC_CACHE_CHECK(for tr1/unordered_set,
  ac_cv_cxx_tr1_unordered_set,
  ac_cv_cxx_tr1_unordered_set,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  AC_TRY_COMPILE([#include <tr1/unordered_set>], [using std::tr1::unordered_set;],
  AC_TRY_COMPILE([#include <tr1/unordered_set>], [using std::tr1::unordered_set;],
  ac_cv_cxx_tr1_unordered_set=yes, ac_cv_cxx_tr1_unordered_set=no)
  ac_cv_cxx_tr1_unordered_set=yes, ac_cv_cxx_tr1_unordered_set=no)
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_tr1_unordered_set" = yes; then
  if test "$ac_cv_cxx_tr1_unordered_set" = yes; then
    AC_DEFINE(HAVE_TR1_UNORDERED_SET,,[Define if tr1/unordered_set is present. ])
    AC_DEFINE(HAVE_TR1_UNORDERED_SET,,[Define if tr1/unordered_set is present. ])
  fi
  fi
])
])
</code></pre></td>
        <td class="diff"><pre><code><title></code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>Support for C++0x dialect.</code></pre></td>
        <td class="diff"><pre><code>Support for C++0x dialect.</code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>
Check for baseline language coverage in the compiler for the C++0xstandard.
Check for baseline language coverage in the compiler for the C++0xstandard.
# AC_COMPILE_STDCXX_OX
# AC_COMPILE_STDCXX_OX
AC_DEFUN([AC_COMPILE_STDCXX_0X], [
AC_DEFUN([AC_COMPILE_STDCXX_0X], [
  AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
  AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
  ac_cv_cxx_compile_cxx0x_native,
  ac_cv_cxx_compile_cxx0x_native,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  AC_TRY_COMPILE([
  AC_TRY_COMPILE([
  template <typename T>
  template <typename T>
    struct check
    struct check
    {
    {
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
    };
    };
    typedef check<check<bool>> right_angle_brackets;
    typedef check<check<bool>> right_angle_brackets;
    int a;
    int a;
    decltype(a) b;
    decltype(a) b;
    typedef check<int> check_type;
    typedef check<int> check_type;
    check_type c;
    check_type c;
    check_type&& cr = c;],,
    check_type&& cr = c;],,
  ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
  ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
  AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
  ac_cv_cxx_compile_cxx0x_cxx,
  ac_cv_cxx_compile_cxx0x_cxx,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  ac_save_CXXFLAGS="$CXXFLAGS"
  ac_save_CXXFLAGS="$CXXFLAGS"
  CXXFLAGS="$CXXFLAGS -std=c++0x"
  CXXFLAGS="$CXXFLAGS -std=c++0x"
  AC_TRY_COMPILE([
  AC_TRY_COMPILE([
  template <typename T>
  template <typename T>
    struct check
    struct check
    {
    {
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
    };
    };
    typedef check<check<bool>> right_angle_brackets;
    typedef check<check<bool>> right_angle_brackets;
    int a;
    int a;
    decltype(a) b;
    decltype(a) b;
    typedef check<int> check_type;
    typedef check<int> check_type;
    check_type c;
    check_type c;
    check_type&& cr = c;],,
    check_type&& cr = c;],,
  ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
  ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
  CXXFLAGS="$ac_save_CXXFLAGS"
  CXXFLAGS="$ac_save_CXXFLAGS"
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
  AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
  ac_cv_cxx_compile_cxx0x_gxx,
  ac_cv_cxx_compile_cxx0x_gxx,
  [AC_LANG_SAVE
  [AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  ac_save_CXXFLAGS="$CXXFLAGS"
  ac_save_CXXFLAGS="$CXXFLAGS"
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
  AC_TRY_COMPILE([
  AC_TRY_COMPILE([
  template <typename T>
  template <typename T>
    struct check
    struct check
    {
    {
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
    };
    };
    typedef check<check<bool>> right_angle_brackets;
    typedef check<check<bool>> right_angle_brackets;
    int a;
    int a;
    decltype(a) b;
    decltype(a) b;
    typedef check<int> check_type;
    typedef check<int> check_type;
    check_type c;
    check_type c;
    check_type&& cr = c;],,
    check_type&& cr = c;],,
  ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
  ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
  CXXFLAGS="$ac_save_CXXFLAGS"
  CXXFLAGS="$ac_save_CXXFLAGS"
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
  if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
     test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
     test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
     test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
     test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
    AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
    AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
  fi
  fi
])
])
Check for library coverage of the C++0xstandard.
Check for library coverage of the C++0xstandard.
# AC_HEADER_STDCXX_0X
# AC_HEADER_STDCXX_0X
AC_DEFUN([AC_HEADER_STDCXX_0X], [
AC_DEFUN([AC_HEADER_STDCXX_0X], [
  AC_CACHE_CHECK(for ISO C++ 0x include files,
  AC_CACHE_CHECK(for ISO C++ 0x include files,
  ac_cv_cxx_stdcxx_0x,
  ac_cv_cxx_stdcxx_0x,
  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
  AC_LANG_SAVE
  AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  ac_save_CXXFLAGS="$CXXFLAGS"
  ac_save_CXXFLAGS="$CXXFLAGS"
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
  AC_TRY_COMPILE([
  AC_TRY_COMPILE([
    #include <cassert>
    #include <cassert>
    #include <ccomplex>
    #include <ccomplex>
    #include <cctype>
    #include <cctype>
    #include <cerrno>
    #include <cerrno>
    #include <cfenv>
    #include <cfenv>
    #include <cfloat>
    #include <cfloat>
    #include <cinttypes>
    #include <cinttypes>
    #include <ciso646>
    #include <ciso646>
    #include <climits>
    #include <climits>
    #include <clocale>
    #include <clocale>
    #include <cmath>
    #include <cmath>
    #include <csetjmp>
    #include <csetjmp>
    #include <csignal>
    #include <csignal>
    #include <cstdarg>
    #include <cstdarg>
    #include <cstdbool>
    #include <cstdbool>
    #include <cstddef>
    #include <cstddef>
    #include <cstdint>
    #include <cstdint>
    #include <cstdio>
    #include <cstdio>
    #include <cstdlib>
    #include <cstdlib>
    #include <cstring>
    #include <cstring>
    #include <ctgmath>
    #include <ctgmath>
    #include <ctime>
    #include <ctime>
    #include <cwchar>
    #include <cwchar>
    #include <cwctype>
    #include <cwctype>
    #include <algorithm>
    #include <algorithm>
    #include <array>
    #include <array>
    #include <bitset>
    #include <bitset>
    #include <complex>
    #include <complex>
    #include <deque>
    #include <deque>
    #include <exception>
    #include <exception>
    #include <fstream>
    #include <fstream>
    #include <functional>
    #include <functional>
    #include <iomanip>
    #include <iomanip>
    #include <ios>
    #include <ios>
    #include <iosfwd>
    #include <iosfwd>
    #include <iostream>
    #include <iostream>
    #include <istream>
    #include <istream>
    #include <iterator>
    #include <iterator>
    #include <limits>
    #include <limits>
    #include <list>
    #include <list>
    #include <locale>
    #include <locale>
    #include <map>
    #include <map>
    #include <memory>
    #include <memory>
    #include <new>
    #include <new>
    #include <numeric>
    #include <numeric>
    #include <ostream>
    #include <ostream>
    #include <queue>
    #include <queue>
    #include <random>
    #include <random>
    #include <regex>
    #include <regex>
    #include <set>
    #include <set>
    #include <sstream>
    #include <sstream>
    #include <stack>
    #include <stack>
    #include <stdexcept>
    #include <stdexcept>
    #include <streambuf>
    #include <streambuf>
    #include <string>
    #include <string>
    #include <tuple>
    #include <tuple>
    #include <typeinfo>
    #include <typeinfo>
    #include <type_traits>
    #include <type_traits>
    #include <unordered_map>
    #include <unordered_map>
    #include <unordered_set>
    #include <unordered_set>
    #include <utility>
    #include <utility>
    #include <valarray>
    #include <valarray>
    #include <vector>
    #include <vector>
  ],,
  ],,
  ac_cv_cxx_stdcxx_0x=yes, ac_cv_cxx_stdcxx_0x=no)
  ac_cv_cxx_stdcxx_0x=yes, ac_cv_cxx_stdcxx_0x=no)
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  CXXFLAGS="$ac_save_CXXFLAGS"
  CXXFLAGS="$ac_save_CXXFLAGS"
  ])
  ])
  if test "$ac_cv_cxx_stdcxx_0x" = yes; then
  if test "$ac_cv_cxx_stdcxx_0x" = yes; then
    AC_DEFINE(STDCXX_0X_HEADERS,,[Define if ISO C++ 0x header files are present. ])
    AC_DEFINE(STDCXX_0X_HEADERS,,[Define if ISO C++ 0x header files are present. ])
  fi
  fi
])
])
As is the case for TR1 support, these autoconf macros can be made for a finer-grained, per-header-file check. For <unordered_map>
As is the case for TR1 support, these autoconf macros can be made for a finer-grained, per-header-file check. For <unordered_map>
# AC_HEADER_UNORDERED_MAP
# AC_HEADER_UNORDERED_MAP
AC_DEFUN([AC_HEADER_UNORDERED_MAP], [
AC_DEFUN([AC_HEADER_UNORDERED_MAP], [
  AC_CACHE_CHECK(for unordered_map,
  AC_CACHE_CHECK(for unordered_map,
  ac_cv_cxx_unordered_map,
  ac_cv_cxx_unordered_map,
  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
  AC_LANG_SAVE
  AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  ac_save_CXXFLAGS="$CXXFLAGS"
  ac_save_CXXFLAGS="$CXXFLAGS"
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
  AC_TRY_COMPILE([#include <unordered_map>], [using std::unordered_map;],
  AC_TRY_COMPILE([#include <unordered_map>], [using std::unordered_map;],
  ac_cv_cxx_unordered_map=yes, ac_cv_cxx_unordered_map=no)
  ac_cv_cxx_unordered_map=yes, ac_cv_cxx_unordered_map=no)
  CXXFLAGS="$ac_save_CXXFLAGS"
  CXXFLAGS="$ac_save_CXXFLAGS"
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_unordered_map" = yes; then
  if test "$ac_cv_cxx_unordered_map" = yes; then
    AC_DEFINE(HAVE_UNORDERED_MAP,,[Define if unordered_map is present. ])
    AC_DEFINE(HAVE_UNORDERED_MAP,,[Define if unordered_map is present. ])
  fi
  fi
])
])
# AC_HEADER_UNORDERED_SET
# AC_HEADER_UNORDERED_SET
AC_DEFUN([AC_HEADER_UNORDERED_SET], [
AC_DEFUN([AC_HEADER_UNORDERED_SET], [
  AC_CACHE_CHECK(for unordered_set,
  AC_CACHE_CHECK(for unordered_set,
  ac_cv_cxx_unordered_set,
  ac_cv_cxx_unordered_set,
  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
  AC_LANG_SAVE
  AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_LANG_CPLUSPLUS
  ac_save_CXXFLAGS="$CXXFLAGS"
  ac_save_CXXFLAGS="$CXXFLAGS"
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
  AC_TRY_COMPILE([#include <unordered_set>], [using std::unordered_set;],
  AC_TRY_COMPILE([#include <unordered_set>], [using std::unordered_set;],
  ac_cv_cxx_unordered_set=yes, ac_cv_cxx_unordered_set=no)
  ac_cv_cxx_unordered_set=yes, ac_cv_cxx_unordered_set=no)
  CXXFLAGS="$ac_save_CXXFLAGS"
  CXXFLAGS="$ac_save_CXXFLAGS"
  AC_LANG_RESTORE
  AC_LANG_RESTORE
  ])
  ])
  if test "$ac_cv_cxx_unordered_set" = yes; then
  if test "$ac_cv_cxx_unordered_set" = yes; then
    AC_DEFINE(HAVE_UNORDERED_SET,,[Define if unordered_set is present. ])
    AC_DEFINE(HAVE_UNORDERED_SET,,[Define if unordered_set is present. ])
  fi
  fi
])
])
</code></pre></td>
        <td class="diff"><pre><code><title></code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>  Container::iterator_type is not necessarily Container::value_type*</code></pre></td>
        <td class="diff"><pre><code>  Container::iterator_type is not necessarily Container::value_type*</code></pre></td>
      </tr>
      <tr class="diffcode">
        <td class="diff"><pre><code>
  This is a change in behavior from the previous version. Now, most
  This is a change in behavior from the previous version. Now, most
  iterator_type typedefs in container classes are POD
  iterator_type typedefs in container classes are POD
  objects, not value_type pointers.
  objects, not value_type pointers.
Bibliography
Bibliography
  
  
    
    
      
      
        
        
          Migrating to GCC 4.1
          Migrating to GCC 4.1
        
        
        
        
    
    
    
    
      Dan
      Dan
      Kegel
      Kegel
    
    
  
  
  
  
    
    
      
      
        
        
          Building the Whole Debian Archive with GCC 4.1: A Summary
          Building the Whole Debian Archive with GCC 4.1: A Summary
        
        
      
      
    
    
    
    
      Martin
      Martin
      Michlmayr
      Michlmayr
    
    
  
  
  
  
    
    
      
      
        
        
          Migration guide for GCC-3.2
          Migration guide for GCC-3.2
        
        
      
      
    
    
  
  
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.