[Bug libstdc++/46572] New: forward_list nodes are not packed

kyle.kloepper at riverbed dot com gcc-bugzilla@gcc.gnu.org
Fri Nov 19 22:25:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46572

           Summary: forward_list nodes are not packed
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kyle.kloepper@riverbed.com


I was playing around with forward_list and realized that all the list nodes
took up a minimum of 16 bytes (with larger sizes in multiples of 8--I am using
a 64-bit machine). This conflicts with what the standard notes in 23.3.3
paragraph 1:

Note: It is intended that forward_list have zero space or time overhead
relative to a hand-written C-style singly linked list.

If I was implementing a memory space critical linked list I would decorate the
list node struct with packed. This is not possible to do with the internal list
node.

I will upload an example program shortly.



More information about the Gcc-bugs mailing list