C++ if statement oddity

by Ian Davis on November 28, 2008

in Uncategorized

I found that you can do work such as assigning a variable and executing a method outside of the main expression of an if statement. For example:

if(hRes = GetApplicationState(), NT_SUCCESS(hRes))
{
// Do something
}
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • email
  • LinkedIn
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter
blog comments powered by Disqus

Previous post:

Next post: