We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
typedef uint8_t BDADDR_t[6]; typedef struct { uint8_t State; BDADDR_t RemoteBDADDR; uint16_t DataPacketsQueued; uint16_t Handle; uint8_t LinkType; uint8_t CurrentIdentifier; bool LocallyInitiated; }ATTR_PACKED BT_HCI_Connection_t; BT_HCI_Connection_t HCIConnection;
The address of HCIConnection is:0x1000004E and the memory data start from 0x1000004E is as following: 03 10 a3 15 83 15 00 00. So I think the State = 03; the BDADDR is 00 15 83 15 a3 10, but the watch window show that the BDADDR is 00 00 15 83 15 a3. So what should I do to get the correct value of a mix typed struct?
Another question: Does the effect of #pragma pack(1) is the same as __packed ? Thanks!
chris
Note that I didn't write just "never". I did write "never make assumptions". If you can prove your assumption always true then you are home free.
But the majority of assumptions doesn't even make it as far as a comment in the source code "This code assumes that the compiler ..." and it is even less common that there are some form of test bench or assert solution to validate the functionality.
So applications tends to be released because they "seem to work", based on testing by a tester who don't even know that the product is a house of cards built based on undocumented assumptions.