I have started today to program on a PIC16f88, and found that the header for its registers contains a union
that only contains a struct
:
extern volatile unsigned char ANSEL __at(0x09B);
typedef union {
struct {
unsigned ANS0 :1;
unsigned ANS1 :1;
unsigned ANS2 :1;
unsigned ANS3 :1;
unsigned ANS4 :1;
unsigned ANS5 :1;
unsigned ANS6 :1;
};
} ANSELbits_t;
extern volatile ANSELbits_t ANSELbits __at(0x09B);
Does it provide any benefits to enclose the struct
inside a union
that only contains that struct
?
Its access I guess is going to be exactly the same as if it were a simple struct
(because the struct
is anonymous):
ANSELbits.ANS4 = 0;
union
? – Funiculus