Forum Discussion
Altera_Forum
Honored Contributor
15 years agoTypically neither '& 0xff' nor '% 256' will remove the warning (about assigning to a narrower integral type), an explict '(unsigned char)' cast will, but the compiler is likely to generate an (or maybe another) unnecessary mask with 255.
Although I usually compile with '-Wall -Wshadow -Wcast-qual -Wmissing-prototypes -Wpointer-arith -Wwrite-strings -Werror' I disable all the warnings about integer convertions. I really don't like casts!