Pedro Izecksohn <[EMAIL PROTECTED]> wrote:
> Peternilsson42 replied:
> > Pedro Izecksohn wrote:
> > > If any value not zero is true why "true which expands to
> > > the integer constant 1"?
> >
> > How can a macro expand to multiple values? That's the
> > problem.
>
> #define true (_Bool)1
#define true ((_Bool)1)
> And:
>
> int i=5;
> _Bool b=true;
>
> if (i==b) // should generate a warning.
C doesn't have warnings, it has diagnostics. The only
diagnostics required by C itself are in relation to
constraint violations. Constraints mean errors, even
if many violations are commonly only diagnosed with
what a compiler calls a warning.
If you're suggesting this should be an error, then
should the following be an error also?
...define true...
struct
{
unsigned flag1 : 1;
unsigned flag2 : 1;
: : :
unsigned flagN : 1;
} x;
if (x.flag1 == true)
--
Peter