Re: Opendialog problem
- From: "Rudy Velthuis" <newsgroups@xxxxxxxxxxxx>
- Date: Fri, 29 Dec 2006 18:52:14 +0000 (UTC)
David Kerber wrote:
In article <xn0evjvcojwg6o2008@xxxxxxxxxxxxxx>,
newsgroups@xxxxxxxxxxxx says...
Jim P wrote:
if opendialog.execute = true then
Why would you do:
if mybooleanexpression = true then
It suffices (and is much safer) if one does:
if mybooleanexpression then
I realize it suffices, but why is it safer?
Because a boolean doesn't have to be 0 or 1.
If it is e.g. 3 (yes, I know this is not a valid value, but you
sometimes see it when API functions are declared as returning a boolean
when in fact they return something else), the comparison with True will
fail. If you don't compare to True, the value will be compared to 0
only, and even API functions declared the wrong way will either return
0 or a value <> 0.
--
Rudy Velthuis http://rvelthuis.de
"When you hear hoofbeats, think of horses, not zebras."
-- Old saying
.
- References:
- Opendialog problem
- From: Gert Baars
- Re: Opendialog problem
- From: Jim P
- Re: Opendialog problem
- From: Gert Baars
- Re: Opendialog problem
- From: Jim P
- Re: Opendialog problem
- From: Rudy Velthuis
- Re: Opendialog problem
- From: David Kerber
- Opendialog problem
- Prev by Date: Re: Opendialog problem
- Next by Date: Re: Opendialog problem
- Previous by thread: Re: Opendialog problem
- Next by thread: Re: Opendialog problem
- Index(es):
Relevant Pages
|