F
Francois Grieu
I just tested my code for portability problems on systems
where int is 16-bit, and found one such system where
#include <stdio.h>
int main(void)
{
printf("%d\n", 0<(unsigned short)0x8000 );
return 0;
}
outputs 0. If I change 0< to 0u<, the output is 1.
Is that a bug in this compiler, w.r.t. C99?
As an aside, 6.5.8p2 puzzles me; it reads:
"One of the following shall hold:
— both operands have real type;
— both operands are pointers to qualified or unqualified versions
of compatible object types; or
— both operands are pointers to qualified or unqualified versions
of compatible incomplete types.
(..)"
Would my example imply conversion to *real*, at least conceptually ?!
As an aside of the aside, I do not understand the third option in
the constraint, and it has been removed in N1570.
TIA,
Francois Grieu
where int is 16-bit, and found one such system where
#include <stdio.h>
int main(void)
{
printf("%d\n", 0<(unsigned short)0x8000 );
return 0;
}
outputs 0. If I change 0< to 0u<, the output is 1.
Is that a bug in this compiler, w.r.t. C99?
As an aside, 6.5.8p2 puzzles me; it reads:
"One of the following shall hold:
— both operands have real type;
— both operands are pointers to qualified or unqualified versions
of compatible object types; or
— both operands are pointers to qualified or unqualified versions
of compatible incomplete types.
(..)"
Would my example imply conversion to *real*, at least conceptually ?!
As an aside of the aside, I do not understand the third option in
the constraint, and it has been removed in N1570.
TIA,
Francois Grieu