[Python-ideas] improving C structs layout

Antoine Pitrou solipsis at pitrou.net
Wed May 8 19:58:59 CEST 2013


Le mercredi 08 mai 2013 à 10:51 -0700, Andrew Barnert a écrit :
> > Well, you can be sure that int <= long, and in most cases you can assume
> > other inequalities such as int <= pointer and int <= double (and even
> > pointer <= double). The long <=> pointer relationship is less
> > predictable, but on common platforms long <= pointer.
> > 
> > So, double then pointer then long then int.
> 
> On a platform with 64-bit long and 32-bit pointer, this would leave a
> gap.

And this isn't very interesting since:

> Fortunately, even though this is perfectly legal, no major platform
> has these sizes.

... which is precisely my point ("on common platforms long <= pointer").

> And that's exactly why you have to prioritize for the most important
> platforms, instead of only pretending that standards make that
> unnecessary.

I didn't pretend so, but perhaps you are trolling.

Besides, we are talking about an optimization, not something which
breaks expected behaviour.

Regards

Antoine.





More information about the Python-ideas mailing list