Thread overview |
---|
May 03, 2008 [Issue 2065] New: Return value of std.file.exists() is inverted. | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2065 Summary: Return value of std.file.exists() is inverted. Product: D Version: 2.014 Platform: PC URL: http://dsource.org/projects/phobos/changeset/683 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: andrei@metalanguage.com ReportedBy: torhu@yahoo.com In r683, the Windows version of this function is changed into return the wrong value. The correct return statement would be "return result != 0xFFFFFFFF;" The relevant docs: http://msdn.microsoft.com/en-us/library/aa915578.aspx -- |
May 03, 2008 [Issue 2065] Return value of std.file.exists() is inverted. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2065 andrei@metalanguage.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED ------- Comment #1 from andrei@metalanguage.com 2008-05-03 11:25 ------- (In reply to comment #0) > In r683, the Windows version of this function is changed into return the wrong value. > > The correct return statement would be "return result != 0xFFFFFFFF;" > > The relevant docs: http://msdn.microsoft.com/en-us/library/aa915578.aspx Ouch. How did that ever go through? The fix will go into the next release. Thanks! -- |
May 12, 2008 [Issue 2065] Return value of std.file.exists() is inverted. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2065 ------- Comment #2 from bugzilla@digitalmars.com 2008-05-12 15:47 ------- I'm having a hard time seeing how: return (result == 0xFFFFFFFF) ? 0 : 1; is different from: return result != 0xFFFFFFFF; -- |
May 12, 2008 [Issue 2065] Return value of std.file.exists() is inverted. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2065 ------- Comment #3 from andrei@metalanguage.com 2008-05-12 15:55 ------- (In reply to comment #2) > I'm having a hard time seeing how: > > return (result == 0xFFFFFFFF) ? 0 : 1; > > is different from: > > return result != 0xFFFFFFFF; I see that revision 682 and before had: return (result == 0xFFFFFFFF) ? 0 : 1; which is correct. In revision 683 I fixed exists to return bool instead of int (just like $DEITY intended it) and in the process I introduced the bug: return result == 0xFFFFFFFF; The one I recently checked into dsource has: return result != 0xFFFFFFFF; which should fix the bug. Sorry for the mistake. -- |
May 12, 2008 Re: [Issue 2065] Return value of std.file.exists() is inverted. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | On 12/05/2008, d-bugmail@puremagic.com <d-bugmail@puremagic.com> wrote:
> I'm having a hard time seeing how:
>
> return (result == 0xFFFFFFFF) ? 0 : 1;
>
> is different from:
>
> return result != 0xFFFFFFFF;
It's certainly conceptually different. The first one returns an int, with possible values 0 and 1. The second one returns a bool with possible values false and true.
|
May 12, 2008 [Issue 2065] Return value of std.file.exists() is inverted. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2065 ------- Comment #5 from andrei@metalanguage.com 2008-05-12 16:41 ------- (In reply to comment #4) > On 12/05/2008, d-bugmail@puremagic.com <d-bugmail@puremagic.com> wrote: > > I'm having a hard time seeing how: > > > > return (result == 0xFFFFFFFF) ? 0 : 1; > > > > is different from: > > > > return result != 0xFFFFFFFF; > > It's certainly conceptually different. The first one returns an int, with possible values 0 and 1. The second one returns a bool with possible values false and true. > In fact it seems the constants 0 and 1 are implicitly convertible to bool but no other integral values, which is a nice touch. I tried this program and was pleasantly surprised: void main() { bool a = 0; bool b = 1; bool c = 2; } It does not compile, but it does if you remove the definition of c. This is the kind of smarts that I'd like to extend to inferring data ranges and signedness. -- |
May 17, 2008 [Issue 2065] Return value of std.file.exists() is inverted. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2065 andrei@metalanguage.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED ------- Comment #6 from andrei@metalanguage.com 2008-05-17 11:24 ------- Fixed in 2.014. -- |
May 22, 2008 [Issue 2065] Return value of std.file.exists() is inverted. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2065 ------- Comment #7 from bugzilla@digitalmars.com 2008-05-22 05:03 ------- Fixed dmd 1.030 and 2.014 -- |
Copyright © 1999-2021 by the D Language Foundation