Pelles C forum
Pelles C => FAQ => Topic started by: Grincheux on December 10, 2019, 04:27:19 PM
-
Could you make a thread on that subject.
Because I don't understand anything.
I have tested many compilers and Pelle is the only one that emits that kind of warning. I suppose it is is a good thing. But and can I correct this warning in my code.
Thank You
-
Unreachable, or dead, code is that code that will never be executed, and for this reason will not be emitted by the compiler.
These parts are normally generated when a conditional execution resolves to a constant comparison that allows the compiler to evaluate that the code will never execute during compilation. I.e.
const a=2; //This is a constant value
...
if (a ==10) //This condition will never be true. The code will be removed
{
printf("Dead code. Will never be executed!\");
}
Another example is when there is code after a return statement:
void foo(void)
{
printf("foo()\n");
return;
printf("Dead code. Will never be executed!\");
}
The warn is very useful if you put the code there by mistake.
-
Ok Frankie, I had understood this but this is not always the case.
Specially this one :
uint64_t crc64speed(uint64_t crc, const void *s, const uint64_t l)
{
/* Quickly check if CRC table is initialized to little endian correctly. */
#ifndef CRC64SPEED_DUAL
check_init(crc64_table, LITTLE1);
#else
check_init(crc64_table_little, LITTLE1);
#endif
return crcspeed64little(dual ? crc64_table_little : crc64_table, crc,(void *)s, l);
}
return crcspeed64little(dual ? crc64_table_little : crc64_table, crc,(void *)s, l);
https://github.com/mattsta/crcspeed (https://github.com/mattsta/crcspeed)
https://github.com/mattsta/crc64-compare (https://github.com/mattsta/crc64-compare)
https://matt.sh/redis-crcspeed (https://matt.sh/redis-crcspeed)
-
What is the exact warning text?
On which line? In the following line?
return crcspeed64little(dual ? crc64_table_little : crc64_table, crc,(void *)s, l);
It could also be a bug...