On Thu, 11 Dec 2003 22:26:39 +0000
Phil Thompson <[EMAIL PROTECTED]> wrote:

[ .. ]

> Is there a "standard" way of handling the case where the C++ compiler doesn't 
> support the bool type?
> 
Page 3 and 4 of Scott Meyers' "More Effective C++" indicates two ways:

1. enum bool { false, true };

disadvantage that it breaks when compiling with a compiler that truly supports
bool. For instance:

void f(int);
void f(bool);

int x, y;

f(x<y); // it calls f(int) when f(bool) is expected

2.
typedef int bool;
const bool false = 0;
const bool true = 1;

disadvantage that you can't differentiate between f(int) and f(bool) when
overloading.


So, option 2 looks safer to me (less free, too).
Anyhow, I'd like to see such workarounds within
#define SIP_HAS_NO_BOOL
#endif
construct.

Gerard

_______________________________________________
PyKDE mailing list    [EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to