11.07.2015 Views

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ICCV8 <strong>for</strong> AVR – C Compiler <strong>for</strong> Atmel AVR!W (6):[warning] [MISRA 2180]numeric constant of type `int' encountered whereconstant of type `unsigned int' expectedMISRA requires numeric constants to have proper types. That means <strong>the</strong>n no numericconstant shall be a subject to a conversion that changes it type; instead, wherepossible, <strong>the</strong> numeric constant shall be suffixed so it has <strong>the</strong> suitable type. Forexample:unsigned f(unsigned i){return i + 1; // WARNING: <strong>the</strong> literal "1" has type "int"whereas// an integer of type "unsigned int" is expected}double g(void){return 1.f; // WARNING: <strong>the</strong> literal "1.f" has type"float",// but a value of type "double" is expected}unsigned char h(void){return 1; // OK: <strong>the</strong> literal has type "int" whichdiffers// from <strong>the</strong> expected type "unsigned char", but// <strong>the</strong>re is no suffix <strong>for</strong> this type, so <strong>the</strong>// <strong>compiler</strong> keeps silence}The following functions are examples of <strong>the</strong> proper use of <strong>the</strong> numeric suffixes:unsigned f(unsigned i){return i + 1u; // OK}double g(void){return 1.;}// OK171

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!