### Struct and Union

`struct` and `union` are supported since version 0.4, and this support is efficient. Unlike several other well known compilers, `cpik` offers full support: `struct`s can be passed to functions as parameters and can be returned by functions.

`struct`s are passed to function by value, as specified by the standard. Anonymous `struct`s are supported. `struct`s are perfectly compatible with `typedef`. `struct`s entities can be affected to other entities of same type.

`struct`s are guaranteed to be compact: as PIC-18 architecture does not impose any alignment constraint, the size of a `struct` is the sum of the sizes of its members10.

`struct`s cannot be larger than 128 bytes11, but I suppose it is not a terrible limitation for a 8 bit microcontroller.

Members of `struct`s can be signed or unsigned bit fields. As stated by the standard, a bit field cannot cross an `int` boundary, so the size of a bit field can range from 1 to 8 bits. For example, in the following code

    struct XXX
    {
      unsigned a: 4 ,
               b: 4 ;
    } xxx ;

    struct YYY
    {
      unsigned a: 5 ,
               b: 4 ;
    } yyy ;

the variable `xxx` is exactly 1 byte long, but the variable `yyy` is 2 bytes long because the second field is one bit too long to be inserted in the first byte.

Bits are specified from low to high (so, in the above examples, `a` is the low nibble)

#### Footnotes

... members 10
  However, this feature does no apply to structures composed of bit-fields, as explainded below.
... bytes 11
  This feature is due to hardware limitation