Bob Paddock wrote:
On Fri, Jul 24, 2009 at 3:59 AM, David Brown<da...@westcontrol.com> wrote:

The principle is right, the details are wrong.  You want:

       uint8_t * volatile tx_tail;

These things are so very easy to get wrong that I always use typedefs:

       typedef uint8_t * pUint8_t;
       volatile pUint8_t tx_tail;

That way there is no room for confusion or error.


There is always the 'cdecl' program that does
 English <--> C/C++ declarations translations.

ftp://sunsite.unc.edu/pub/Linux/devel/lang/c/cdecl-2.5.tar.gz
ftp://ftp.delorie.com/pub/djgpp/current/v2apps/cdecl25b.zip
ftp://ftp.delorie.com/pub/djgpp/current/v2apps/cdecl25s.zip

cdecl> explain volatile *x
declare x as pointer to volatile int

cdecl> explain int volatile *x
declare x as volatile pointer to int

Maybe cdecl could be included in WinAVR?

From testing here it doesn't look like cdecl is entirely reliable. But even it were, it is hardly a good idea to write code declarations that are so convoluted that you need extra utilities to interpret them. It is a much better idea to write clear and unambiguous code in the first place - that's what typedefs give you.



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to