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.
please explain me why the sizeof (C51) returns 6 bytes for this struct instead of 5:
typedef struct DEKO_COMM_HEADER { UINT16 m_uiMsgOpcode; UCHAR8 m_sblMsgPriority :2; UINT16 m_sblDataLength :11; UINT16 m_sblMsgTimeStamp :11; }DEKO_COMM_HEADER, *PDEKO_COMM_HEADER;
UINT16 is typedef for unsigned int UCHAR8 is typedef for unsigned char
thanks
mr dovalle
you can n0t assumme how compiler alllocates fields in a structure in a structure
it is undefineded in c standard you know is implermentation specifac!!!!
you should use sizeof so compiler says how much space
some compileer s use pragma as control alignemenent
why you not write code to see asssemblery of compielr producingh???
sorry for my mistake
why you not write code to see asssembler of compiler producing???
you use SRC</b option box
"it is undefineded in c standard "
To be precise, the 'C' standard states that it is Implementation-Defined - this means that the implementation can choose to do whatever it likes, but this must be documented.
sir andy
you are right you know ;)
my book says inplementation specifac
thannk you for my mistake
"thannk you for my mistake"
No mistake - just a clarification, perhaps!
why you not write code to see asssembler of compiler producing??? you use SRC option box
I would not do that. It may be that you are so bright that you never forget to remove the SRC statement, I am not. For that reason, "to see asssembler" I look at the .lst file which does not affect anything.
Erik
sir eric
you are also right again you know!
thanks you for my mistake ;)