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: Theodore A. Roth
Subject: Re: [avr-libc-dev] [RFC] more -mint8 changes for pgmspace.h
Date: Wed, 17 Sep 2003 13:32:56 -0700 (PDT)


On Wed, 17 Sep 2003, E.Weddington wrote:

> > 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:

That was my intent after some feed back. Like I said previously, I'm
not sure what the exact purpose of the prog_* typedefs are.

>
> +       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

No. The (u)int64_t typedefs are not affected by -mint8_t (see
inttypes.h) so can stay defined. The only reason for #if'ing out the
(u)int32_t typedefs is to avoid having the header barf because
(u)int32_t is not defined when using -mint8.

Ted Roth




reply via email to

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