On 12 April 2015 at 23:04, Gerald Pfeifer gerald@pfeifer.com wrote:
Indrek suggested that in this specific case the alternate approach below also should work, so let me provide this as an option in case
It probably would, but note that that doesn't do quite the same thing. BOOL values aren't restricted to TRUE/FALSE, so in principle there's no reason "ret" couldn't be e.g. ~0u. You'd need something like "!ret != !ie10_cache" to preserve the original behaviour, but I'm not sure that's really much better.
Are there any known documented cases where winapi functions that are declared as BOOL return anything other than TRUE / FALSE ? And if that is the case, ret != ie10_cache would catch the difference and thus make it possible to duplicate the behavior in wine, whereas !ret != !ie10_cache would hide it away just as the !ret == ie10_cache currently does and makes it harder to track down if any app depends on such weirdness. So yes, using != would make it behave bit different, but, at least to me, it seems it would actually improve the test to catch any possible and unexpected weirdness as mentioned.
Regards, Indrek
-----Original Message----- From: Henri Verbeet [mailto:hverbeet@gmail.com] Sent: Monday, April 13, 2015 11:13 AM To: wine-devel Cc: Indrek Altpere; Gerald Pfeifer Subject: Re: wininet: Avoid four instances of "logical not is only applied to the to the left hand side".
On 12 April 2015 at 23:04, Gerald Pfeifer gerald@pfeifer.com wrote:
Indrek suggested that in this specific case the alternate approach below also should work, so let me provide this as an option in case
It probably would, but note that that doesn't do quite the same thing. BOOL values aren't restricted to TRUE/FALSE, so in principle there's no reason "ret" couldn't be e.g. ~0u. You'd need something like "!ret != !ie10_cache" to preserve the original behaviour, but I'm not sure that's really much better.
On 13 April 2015 at 10:30, Indrek Altpere efbiaiinzinz@hotmail.com wrote:
Are there any known documented cases where winapi functions that are declared as BOOL return anything other than TRUE / FALSE ?
Documented cases are probably a lost cause, but there's e.g. IDirect3DDevice9::GetLightEnable() that returns 0x80. I'm sure you can find others if you start looking for them. This kind of thing usually happens when there's code of the form "return flags & SOME_FLAG;".
And if that is the case, ret != ie10_cache would catch the difference and thus make it possible to duplicate the behavior in wine, whereas !ret != !ie10_cache would hide it away just as the !ret == ie10_cache currently does and makes it harder to track down if any app depends on such weirdness. So yes, using != would make it behave bit different, but, at least to me, it seems it would actually improve the test to catch any possible and unexpected weirdness as mentioned.
Well, no. It's an implementation detail, and we don't want to duplicate those unless there exist actual applications that depend on them.