JustKernel

Ray Of Hope

Structure Padding

Structure Padding

Most processors require specific memory alignment on variables certain types. Normally the minimum alignment is the size of the basic type in question, fo instance this is common char variables can be byte aligned and appear at any byte boundary short (2 byte) variables must be 2 byte aligned, they can appear at any even […]

Tags:

Posted in Basic C | No Comments »

Structure Padding

Today I learnt a new thing regarding padding. I was programming for Octeon board and using MIPS 64 bit compiler. I was reading the content from the file in the following order uint32 a; uint32 b; uint 16 c; uin8 d; fscanf(“%lu, %lu, %u,%c”, &a, &b, &c, &d) file content (10,20,30,40); But to my surprise, […]

Tags:

Posted in Basic C | No Comments »