L
Lox
Hello all experts. If I compile the following code (small example) I
get "warning: comparison between signed and unsigned integer
expressions".
void test(void)
{
uint8_t a;
uint32_t i;
a = 10;
for(i = 0; i < (a + 1); i++)
{
}
}
But the following code doesn't give that warning:
void test(void)
{
uint8_t a;
uint32_t i;
a = 10;
for(i = 0; i < (uint32_t)(a + 1); i++)
{
}
}
What is going on here? Why does the compiler think (a + 1) is signed?
get "warning: comparison between signed and unsigned integer
expressions".
void test(void)
{
uint8_t a;
uint32_t i;
a = 10;
for(i = 0; i < (a + 1); i++)
{
}
}
But the following code doesn't give that warning:
void test(void)
{
uint8_t a;
uint32_t i;
a = 10;
for(i = 0; i < (uint32_t)(a + 1); i++)
{
}
}
What is going on here? Why does the compiler think (a + 1) is signed?