[c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-30 Thread peternilsson42
Pedro Izecksohn [EMAIL PROTECTED] wrote: ... If I would write the C standard, or I would make restrictions to use true or I would not declare it at all and leave it being any non zero. But this is my actual position: Ten days ago I thought the current true definition a good thing. Until

Re: [c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-29 Thread Pedro Izecksohn
if (i==b) If you're suggesting this should be an error, then should the following be an error also? struct { unsigned flag1 : 1; unsigned flag2 : 1; } x; if (x.flag1 == true) If I would write the C standard, or I would make restrictions to use true or I would not declare

[c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-28 Thread peternilsson42
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

[c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-27 Thread Saurabh Jain
Hi, Reply embedded. --- In c-prog@yahoogroups.com, Shyan Lam [EMAIL PROTECTED] wrote: -Original Message- From: c-prog@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pedro Izecksohn Sent: Saturday, May 26, 2007 10:15 PM If any value not zero is true why true which

[c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-27 Thread peternilsson42
Pedro Izecksohn [EMAIL PROTECTED] 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. Note that C is not the only language with the difficulty. In Pascal (IIRC) and many Basics, it's the least

Re: [c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-27 Thread Pedro Izecksohn
Saurabh Jain asked: are you sure xy == xy??? Am I missing something? Pedro's reply: Shyan Lam, thinking that I mistyped, meant that: if ((x y) == true) may be shortened to: if (x y) But my bug was to think that: if (xy) is equivalent to: if ((xy)==true)

Re: [c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-27 Thread Victor A. Wagner Jr.
Pedro Izecksohn wrote: Saurabh Jain asked: are you sure xy == xy??? Am I missing something? Pedro's reply: Shyan Lam, thinking that I mistyped, meant that: if ((x y) == true) may be shortened to: if (x y) But my bug was to think that: if (xy) is

Re: [c-prog] Re: ISO/IEC 9899:1999 stdbool.h true

2007-05-27 Thread Pedro Izecksohn
I wrote: Peternilsson42 replied: 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 And: int i=5; _Bool b=true; if (i==b) // should generate a warning.