The field part of bit-fields seems to suggest that they can only be fields inside a structure or union.
Can a bit-field be a typical \"stand-alone\" variable, outsid
If not, why so? If bit-fields are basically intended to use less memory, why can't we >declare any variable as a bit-field if we know it won't exceed that size?
Because the memory is fixed at 16 or 32 bits wide. It would be too slow to pack a users 14 bit ints into 16 bits and use the other 2 bits . Its better to waste the 2 bits and don't let you define in efficient storage. Thats why if you really want to you can use a union. You wouldn't be gaining anything by making the compiler work harder for nothing. The people who wrote the compiler were smart. They don't just let a programmer with a bad idea slow things down, sorry/.