Forum Discussion
Altera_Forum
Honored Contributor
11 years agoalt_types.h printf warning
Hi, I am writing some C for a NIOS. I am using the data formats defined in alt_types.h, alt_u32 alt_u16 alt_u8. When I use printf with alt_u32 I am getting a warning: warning: ...
Altera_Forum
Honored Contributor
11 years ago1) Odds are, you can probably just ignore the warning if it's still giving you the correct output (even though the types differ, C will perform an implicit type conversion to convert it into an unsigned integer).
2) If you would like to get rid of the warning, you can always explicitly type cast the variable into a unsigned integer, like so: printf("test2: %08x\n", (unsigned int)test2); 3) If you're going to be passing data into Altera functions (either drivers or the HAL), it's probably best to keep using the alt_* types, although if you don't mind occasionally doing an explicit conversion, you can use the usual types.