[cfe-dev] Obj-C type encoding for bool larger than expected

David Chisnall David.Chisnall at cl.cam.ac.uk
Wed Apr 30 00:53:34 PDT 2014


On 29 Apr 2014, at 19:17, Karl Wagner <razielim at gmail.com> wrote:

> So, it appears that bool is being treated as an integer type, and hence will be expanded to the size of an int (i.e. 4 bytes on 32-bit/ILP64/LLP64 targets) when encoded. That explains the odd size of bool.

Yes, because that's how the calling convention requires bools to be passed.  This is the space in the argframe.  Your packed struct, in contrast, will not be promoted.  

As I said, these numbers tell you the offset in a legacy struct that is an ad-hoc variation of va_args originally designed for the m68k.  If you are using them for anything after about 1995, then you're probably doing it wrong.

David





More information about the cfe-dev mailing list