On Sun, 30 Jan 2005, E. Weddington wrote:
I have trouble remembering things that I don't use regularly, so I don't
find this argument particularly convincing.
I am against intentionally making tools hard to use for beginners but I
think that the "improvements" should have technical merit beyond making
things easier for newbies.
- The typecasts are in there to workaround the C language Standard of
promoting the operands of bit operaters to ints, which are 16 bits for
the AVR (see the avr-libc FAQ for more discussion of this). If these
macros are used, then users don't have to remember to do the typecasts,
which should, in theory, help with the size of their code.
A good point... but isn't there a way to do this during the build process?
I would also like to propose two other macros for this file:
#define BIT(x) (1 << (x))
#define LONGBIT(x) ((uint32_t)1 << (x))
Yes, the BIT() macro is the same as _BV(). The _BV() macro is confusing
in two ways: one has to remember that "BV" stands for Bit Value. The
name BIT is slightly more descriptive. And _BV() has a leading
underscore, which technically is supposed to be reserved for the
"implementation" according to the C Standard (in this case the library).
Having to type out the underscore is annoying. I feel that it's easier
to just write out "BIT".
As an alternative to this suggestion, I would advocate adding some simple
bit value macros. They are fewer characters to type and do not require
special treatement of larger words.
#define B0 0x01
#defind B1 0x02
...