The keyword __attribute__ allows you to specify special attributes of struct and union types when you define such types. This is mostly encountered when designing code with particular care on memory footprint optimisation.  I have encountered this several times in some Apple headers while digging for documentation for my kext projects, and I thought it would be useful to explain it a bit. For example (from AppleUSBCDCCommon.h):

typedef struct
    UInt8 	bmRequestType;
    UInt8 	bNotification;
	UInt16	wValue;
	UInt16	wIndex;
	UInt16	wLength;
} __attribute__((packed)) Notification;

More reading:

C#, SCPI and Keysight (Agilent) DSO-X 2002A

This post is a relic. The initial draft dates back in January 19, 2013. And was left as draft ever since. Past couple of days I was busy — among other things — learning a new programming language, C#. 🙂 Ok, here’s the deal: my scope (KeysightAgilent DSO-X 2002A) is SCPI–compliant device. If you remember, the reason behind […]

…and the order from DigiKey

Ok. Today was THE mail day. I’ve received both my electronic parts orders, the one from RF Parts and the one from DigiKey, that I placed several weeks ago (but had some issues with a couple of backordered items). Ta–Da ! This is it: A lot of bags and goodies. Not to mention the pleasure of sorting […]

Leave a Reply

Your email address will not be published. Required fields are marked *