avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [RFC] more -mint8 changes for pgmspace.h


From: E . Weddington
Subject: Re: [avr-libc-dev] [RFC] more -mint8 changes for pgmspace.h
Date: Wed, 17 Sep 2003 20:15:26 GMT

> The attached patch should make the pgmspace.h header 
safer in most
> uses.
> 
> There's still some warts with the prog_* typedefs though.
> 
> The most controversial change is the removal of defining 
the pgm_*_far
> macros to pgm_*_near. I did this because I felt that 
those defs break
> the "principle of least surprise." Basically, if you use 
those and
> then port to a new device (say from mega128 to mega64), 
your code will
> compile but the result is not what you intended. Better 
to have to
> compiler raise an error that the macro is undefined 
letting you know
> that you code is broken.
> 
> Objections?
> 


Not really. But while you're at it, instead of your FIXME, 
why not replace the prog_[int,long,long_long] with your 
definitions:

+       typedef int16_t   prog_int16_t  PROGMEM;
+       typedef uint16_t  prog_uint16_t PROGMEM;
+       #if !defined(__USING_MINT8)
+       typedef int32_t   prog_int32_t  PROGMEM;
+       typedef uint32_t  prog_uint32_t PROGMEM;
+       #endif
+       typedef int64_t   prog_int64_t  PROGMEM;
+       typedef uint64_t  prog_uint64_t PROGMEM; */

But I would also suggest putting the *int64 stuff in the !
defined(_USING_MINT8) block as well:

+       typedef int16_t   prog_int16_t  PROGMEM;
+       typedef uint16_t  prog_uint16_t PROGMEM;
+       #if !defined(__USING_MINT8)
+       typedef int32_t   prog_int32_t  PROGMEM;
+       typedef uint32_t  prog_uint32_t PROGMEM;
+       typedef int64_t   prog_int64_t  PROGMEM;
+       typedef uint64_t  prog_uint64_t PROGMEM; */
+       #endif

All else looks good to me.

Eric







reply via email to

[Prev in Thread] Current Thread [Next in Thread]