Re: A basic question question about volatile use



On 31 Jul, 08:31, Ark Khasin <akha...@xxxxxxxxxxxxxxxxxxxx> wrote:
santosh wrote:
Ark Khasin wrote:

I was under the impression that if a struct contains only uint8_t and
arrays thereof, there is no padding. Is it wrong?

The [u]intN_t types are specified to contain any padding bits, but
padding between structure members of these types in still allowed.

Of course struct {uint8_t a; uint32_t b; uint8_t c;} is likely to have
padding somewhere. But uint8_t alone?..

your declaration looked like this:-

struct T {uint8_t read, write, status, forkicks;};

So you don't have a lone uint8_t you have 4 of them!
I must admit I'd consider it an odd compiler that padded
between uint8_ts like this.

<muse: "how can I annoy jacob?">

I suppose a machine with 24-bit words packing 3 chars
into a word might insert padding.

ccc00c

--
Nick Keighley

.



Relevant Pages