Ruddick,
This is a good start. I agree with most of what you have said except the
following:
1. We need to define what to do with functions defined via macros.
Macros in the .h file are public by definition and macros in the .c file
are private. Macros in c files should probably never be used and
substituted with static functions, possibly inlined
2. There are several rules for typedefs in avr-libc. Probably the most
consistent with what we already have is a lower case words with
underscore and a simple suffix of _t e.g. clock_div_t
The only other question is when to use #defines, enums and const values.
The first two are rvalues. A const value is a non-modifiable lvalue and
the compiler may reserve storage for it e.g.
*int const *N* = 100;*
*int const *p = &N; // ok*
However most people are probably not going to write this type of code.
Defines do not have scope restrictions whereas enums and consts do.
I think we should use the simplest definitions in header files
(#defines) and possibly some enums for a grouping of values. Inside an
implementation then people should use enums and consts. Again enums for
a logical grouping such as a state indicator and consts for individual
constants such as a buffer size.
Mike Perks
Oak Micros (oakmicros.com)
_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev