Should char_traits<char>::int_type be an int or unsigned long?

Gabriel Dos Reis Gabriel.Dos-Reis@cmla.ens-cachan.fr
Sat Feb 10 19:09:00 GMT 2001


Craig Rodrigues <rodrigc@mediaone.net> writes:

[...]

|   template<class _CharT>
|     struct char_traits
|     {
|       typedef _CharT            char_type;
|       // Unsigned as wint_t in unsigned.
|       typedef unsigned long     int_type;

Actually the right place to look at is:

  // 21.1.4  char_traits specializations
  template<>
    struct char_traits<char>
    {
      typedef char              char_type;
      typedef unsigned int      int_type;
      typedef streampos         pos_type;
      typedef streamoff         off_type;
      typedef mbstate_t         state_type;

But it is broken as well.  The Standard says int_type is a typedef for
`int'.

[...]

| What is the correct solution to the problem?

V3 is wrong.  Thanks for the bug-report.

-- Gaby
CodeSourcery, LLC                       http://www.codesourcery.com



More information about the Gcc mailing list