R
Rui Maciel
It's expected that size_t is an unsigned integral type and therefore it has been suggested that (size_t)-1 is
a good, standard-ish way to determine the maximum value representable by a size_t. So I ran the following
code:
<code>
#include <stdio.h>
int main(void)
{
printf("size: %zd\n", (size_t)-1);
return 0;
}
</code>
What I didn't expected was the following output:
<shell>
525 rui@kubuntu:temp$ gcc main.c
526 rui@kubuntu:temp$ ./a.out
size: -1
</shell>
Is this a GCC bug or am I missing out something?
Rui Maciel
a good, standard-ish way to determine the maximum value representable by a size_t. So I ran the following
code:
<code>
#include <stdio.h>
int main(void)
{
printf("size: %zd\n", (size_t)-1);
return 0;
}
</code>
What I didn't expected was the following output:
<shell>
525 rui@kubuntu:temp$ gcc main.c
526 rui@kubuntu:temp$ ./a.out
size: -1
</shell>
Is this a GCC bug or am I missing out something?
Rui Maciel