Issue Details (XML | Word | Printable)

Key: STDCXX-163
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Martin Sebor
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

ios_base data member layout wastes 2 bytes

Created: 15/Mar/06 12:02 AM   Updated: 10/Dec/07 07:08 AM
Return to search
Component/s: 27. Input/Output
Affects Version/s: 4.1.2, 4.1.3, 4.1.4, 4.2.0
Fix Version/s: 5.0.0

Time Tracking:
Not Specified

Environment: all

Severity: Inefficiency


 Description  « Hide
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;



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Martin Sebor added a comment - 10/Dec/07 07:08 AM
This affects all released versions and can't be fixed w/o breaking binary compatibility.
Scheduled for 5.0.