Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 1
    A long time ago when I first started programming, a mentor of mine suggested I get in the habit of doing if( INVALID_HANDLE_VALUE == hFile ) to avoid things like that. That way if you slip up and use one equals sign instead of two, you'll get a compiler error. Obviously this only works when the left-expression is a constant, but it has saved me more head-aches than I can count. Commented Feb 26, 2012 at 3:07
  • if you use a static analysis tool, it would save you hundred times more head-aches, and you are able to restore the nature hFile==INVALID_HANDLE_VALUE writing. Commented Jul 10, 2018 at 23:04