Re: A basic question question about volatile use



Ark Khasin 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?..

I think you are conflating padding bits (which the [u]intN_t types
cannot have) with padding bytes, which are allowed between any two
structure members. It is not allowed between elements of an array.

.



Relevant Pages

  • Re: [RFC v3][PATCH 8/9] File descriprtors (dump)
    ... To maintain compatibility between 32-bit and 64-bit architecture flavors, ... use padding for structure members, ...
    (Linux-Kernel)
  • Re: A basic question question about volatile use
    ... padding between structure members of these types in still allowed. ... your declaration looked like this:- ... I suppose a machine with 24-bit words packing 3 chars ...
    (comp.lang.c)
  • Re: A basic question question about volatile use
    ... santosh wrote: ... arrays thereof, there is no padding. ... padding between structure members of these types in still allowed. ...
    (comp.lang.c)
  • Re: Meaning of memset
    ... Ark Khasin writes: ... 8+8=16-bit int etc, such a C machine would simply ignore the 3 of 11 ... Or it can use for padding, ... unsigned char is possible e.g. for trap values (for instance, ...
    (comp.lang.c)