avr-gcc-list
[Top][All Lists]
Advanced

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

RE: [avr-gcc-list] PreProcessor Warnings


From: Dave Hylands
Subject: RE: [avr-gcc-list] PreProcessor Warnings
Date: Fri, 13 Aug 2004 06:08:41 -0700

The problem is that you're multiplying an int (16 bits) times an int and
generating a value which doesn't fit inside an int.

If you change yur definitions to be:

> #define FLASH_PAGE_NUM 400uL
> #define SPM_PAGESIZE 256uL

Then you're telling the compiler that these constansts are unsigned
longs. You really only need to change one, and the other one will be
"promoted" as well.

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/ 


> -----Original Message-----
> From: address@hidden 
> [mailto:address@hidden On Behalf Of Ramkumar 
> Rengaswamy
> Sent: Friday, August 13, 2004 3:17 AM
> To: address@hidden
> Subject: [avr-gcc-list] PreProcessor Warnings
> 
> 
> Hi,
>    Thanks Ted and everyone for responding to my previous 
> queries. It was a great help !! I am receiving a 
> pre-processor warning on the following code snippet.
> ------------------------------------------------------
> #define FLASH_PAGE_NUM 400
> #define SPM_PAGESIZE 256
> #define FLASH_PAGE_ADDR (FLASH_PAGE_NUM * SPM_PAGESIZE)
> 
> uint16_t a = pgm_read_word_far(FLASH_PAGE_ADDR);
> -------------------------------------------------------
> I know that I am reading the correct address and therefore 
> would like to know if there is any way to supress this warning ?
> 
> Thanks,
> -Ram
> 
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden 
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
> 
> 



reply via email to

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