Re: bool or BOOL in MFC projects
- From: Wolfram Roesler <wr@xxxxxxx>
- Date: Fri, 11 Jan 2008 08:14:13 +0000 (UTC)
"David Webber" <dave@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in news:
#x9b7wpQIHA.536@xxxxxxxxxxxxxxxxxxxx:
How about using "!!", the "make boolean" operator:
#define truth(x) (!!(x))
#define TRUTH(x) (!!(x))
Nice! But I'd have to assuage my conscience with
#define truth(x) ((bool)(!!(x)))
#define TRUTH(x) ((BOOL)(!!(x)))
The cast in truth is a no-op because !! returns bool already,
and the cast in TRUTH is unneeded because a bool can implicitly
be converted into an int (what BOOL is). Also, in C++ programs,
my conscience tells me to avoid C casts altogether. :)
Best regards
Wolfram
.
- Prev by Date: Re: Strange PowerPoint Automation interface failure
- Next by Date: VC6 -> VC2005 conversion problem
- Previous by thread: Strange PowerPoint Automation interface failure
- Next by thread: VC6 -> VC2005 conversion problem
- Index(es):
Relevant Pages
|