[NumPy-Tickets] [NumPy] #1790: dtype(..., align=True) does not insert trailing padding

NumPy Trac numpy-tickets@scipy....
Sat Apr 2 05:13:35 CDT 2011


#1790: dtype(..., align=True) does not insert trailing padding
------------------------+---------------------------------------------------
 Reporter:  pv          |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:  2.0.0   
Component:  numpy.core  |     Version:  devel   
 Keywords:              |  
------------------------+---------------------------------------------------
 Note the following:
 {{{
 >>> dt = np.dtype([('a', 'b'), ('b', 'i'), ('c', 'b')], align=True)
 >>> dt.itemsize
 9
 }}}
 whereas
 {{{
 #include <stdio.h>

 typedef struct {
     char a;
     int b;
     char c;
 } xxx_t;

 int main()
 {
     printf("%d\n", sizeof(xxx_t));
     return 0;
 }

 /* -> sizeof(xxx_t) == 12 */
 }}}

 Changing this might cause problems in third-party code. On the other hand,
 align=True is probably not that often used.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1790>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list