Reading the pthread Library in structure the following is defined:
struct ptw32_thread_t_
{
....
int implicit:1;
......
};
I understand that it occupy only 1 bit then how to give value to it as every value assigned with activate the Overflow Error Flags Compiling gives error:
ptw32_thread_t *sp;
sp = (ptw32_thread_t *) calloc (1, sizeof(ptw32_thread_t));
sp->implicit = 1;
error: overflow in implicit constant conversion [-Werror=overflow]
It's a bad idea to have a 1-bit int
, since it's a signed type. You can't represent 1
using 1 bit when using signed, you can only represent 0
and -1
, which is a bit odd.
The solution is to make it unsigned int implicit : 1
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With