You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2006/03/14 17:05:26 UTC

[jira] Created: (STDCXX-163) ios_base data member layout wastes 2 bytes

ios_base data member layout wastes 2 bytes
------------------------------------------

         Key: STDCXX-163
         URL: http://issues.apache.org/jira/browse/STDCXX-163
     Project: C++ Standard Library
        Type: Improvement
  Components: 27. Input/Output  
    Versions: 4.1.3    
 Environment: all
    Reporter: Martin Sebor
    Priority: Minor


The latest HP aCC beta points out a space inefficiency in the definition of the ios_base class. The next time we break binary compatibility we should rearrange the data mebers to avoid the wasted space.

aCC -c -D_RWSTD_USE_CONFIG -I/build/sebor/aCC-6.07-8s/include -I/build/sebor/dev/stdlib/include  -AA  +O2  +w +wlint +W392 +W655 +W684 +W818 +W819 +W849 +W2193 +W2236 +W2261 +W2340 +W2401 +W2487 +W4255   /build/sebor/dev/stdlib/src/iostream.cpp
"/build/sebor/dev/stdlib/include/rw/_iosbase.h", line 357: remark #4227-D: 
          padding struct with 2 bytes to align member "_C_usr"
      _C_usr_data *_C_usr;      // user data (iword, pword, callbacks)
                   ^

$ cat -n /build/sebor/dev/stdlib/include/rw/_iosbase.h | head -n 360 | tail -n 33
   328      void              *_C_rdbuf;    // pointer to the associated stream buffer
   329      _RWSTD_STREAMSIZE  _C_prec;     // current precision
   330      _RWSTD_STREAMSIZE  _C_wide;     // current width
   331      unsigned           _C_fmtfl;    // formatting flags
   332      unsigned char      _C_state;    // stream state
   333      unsigned char      _C_except;   // active exceptions
   334      
   335      static bool _C_sync_with_stdio;
   336  
   337  private:
   338  
   339      ios_base (const ios_base&);               // not defined
   340      ios_base& operator= (const ios_base&);    // not defined
   341  
   342  #if __EDG_VERSION__ < 245
   343  
   344      // working around an EDG eccp 2.3x bug (also derivatives,
   345      // such as MIPSpro, see PR #28631)
   346  public:
   347      struct _C_usr_data;
   348  
   349  #else
   350  
   351  protected:
   352      struct _C_usr_data;
   353  
   354  #endif   // EDG < 2.45
   355  
   356  protected:
   357      _C_usr_data *_C_usr;      // user data (iword, pword, callbacks)
   358      locale       _C_loc;      // locale associated with stream
   359  
   360      friend struct _RWSTD_EXPORT Init;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (STDCXX-163) ios_base data member layout wastes 2 bytes

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor updated STDCXX-163:
--------------------------------

             Severity: Inefficiency
    Affects Version/s: 4.1.2
                       4.1.4
                       4.2.0
        Fix Version/s: 5.0

This affects all released versions and can't be fixed w/o breaking binary compatibility.
Scheduled for 5.0.

> ios_base data member layout wastes 2 bytes
> ------------------------------------------
>
>                 Key: STDCXX-163
>                 URL: https://issues.apache.org/jira/browse/STDCXX-163
>             Project: C++ Standard Library
>          Issue Type: Improvement
>          Components: 27. Input/Output
>    Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0
>         Environment: all
>            Reporter: Martin Sebor
>            Priority: Minor
>             Fix For: 5.0
>
>
> The latest HP aCC beta points out a space inefficiency in the definition of the ios_base class. The next time we break binary compatibility we should rearrange the data mebers to avoid the wasted space.
> aCC -c -D_RWSTD_USE_CONFIG -I/build/sebor/aCC-6.07-8s/include -I/build/sebor/dev/stdlib/include  -AA  +O2  +w +wlint +W392 +W655 +W684 +W818 +W819 +W849 +W2193 +W2236 +W2261 +W2340 +W2401 +W2487 +W4255   /build/sebor/dev/stdlib/src/iostream.cpp
> "/build/sebor/dev/stdlib/include/rw/_iosbase.h", line 357: remark #4227-D: 
>           padding struct with 2 bytes to align member "_C_usr"
>       _C_usr_data *_C_usr;      // user data (iword, pword, callbacks)
>                    ^
> $ cat -n /build/sebor/dev/stdlib/include/rw/_iosbase.h | head -n 360 | tail -n 33
>    328      void              *_C_rdbuf;    // pointer to the associated stream buffer
>    329      _RWSTD_STREAMSIZE  _C_prec;     // current precision
>    330      _RWSTD_STREAMSIZE  _C_wide;     // current width
>    331      unsigned           _C_fmtfl;    // formatting flags
>    332      unsigned char      _C_state;    // stream state
>    333      unsigned char      _C_except;   // active exceptions
>    334      
>    335      static bool _C_sync_with_stdio;
>    336  
>    337  private:
>    338  
>    339      ios_base (const ios_base&);               // not defined
>    340      ios_base& operator= (const ios_base&);    // not defined
>    341  
>    342  #if __EDG_VERSION__ < 245
>    343  
>    344      // working around an EDG eccp 2.3x bug (also derivatives,
>    345      // such as MIPSpro, see PR #28631)
>    346  public:
>    347      struct _C_usr_data;
>    348  
>    349  #else
>    350  
>    351  protected:
>    352      struct _C_usr_data;
>    353  
>    354  #endif   // EDG < 2.45
>    355  
>    356  protected:
>    357      _C_usr_data *_C_usr;      // user data (iword, pword, callbacks)
>    358      locale       _C_loc;      // locale associated with stream
>    359  
>    360      friend struct _RWSTD_EXPORT Init;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.