Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7010325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:58:35+00:00 2026-05-27T21:58:35+00:00

I am learning C++. I come from a background of: .NET and VB6. I

  • 0

I am learning C++. I come from a background of: .NET and VB6.

I am intrigued about what the following webpage says about booleans: http://msdn.microsoft.com/en-us/library/ff381404(v=vs.85).aspx i.e.

“Despite this definition of TRUE, however, most functions that return a BOOL type can return any non-zero value to indicate Boolean truth. Therefore, you should always write this:

// Right way.
BOOL result = SomeFunctionThatReturnsBoolean();
if (result) 
{ 
    ...
}

“

Does this apply to VB6 as well i.e. is there a problem saying: If BooleanValue = True Then?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:58:36+00:00Added an answer on May 27, 2026 at 9:58 pm

    The Windows API was designed to be used from C programs. Which until C99 didn’t have a bool type. And still doesn’t completely, C99 was never implemented by the Microsoft compiler for example. So they had to come up with a workaround, one that’s highly compatible with the way C compilers deal with logical values. An int where 0 is false and anything else is true. Thus the advice.

    VB6 has a dedicated Boolean type and keywords for the literal values True and False so doesn’t quite have the same problem. You can however still get into trouble with poorly written COM servers. The underlying integral value for True is -1, highly incompatible with many other languages’ implementation of a logical boolean type. Including C. There’s a good reason for VB6 being the oddball, its And and Or operators don’t distinguish between a logical and a arithmetic and/or. By making True equal to -1 and False equal to 0 there is no difference. Trouble can arise when a COM server returns a 1 to indicate true instead of VARIANT_TRUE.

    But most of all, writing If booleanVariable = True Then is just ugly and nails on the blackboard for many programmers. Just write If booleanVariable Then and be done with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning about using Custom Views from the following: http://developer.android.com/guide/topics/ui/custom-components.html#modifying The description says: Class
I've taken up learning vb.net having come from a C# background. I was trying
I come from more of a C# background yet am learning Ruby in my
I come from a Java background and I am learning Objective C. I am
I come from an ExtJS background and am slowly learning jQuery. I am trying
I come from a C# background, but I'm learning C at the moment. In
I come from a .NET background, using dependency injection containers like Unity, Ninject, Castle
I come from python background and am learning ruby. IPython is really awesome. I
I come from a C# background and I am learning Objective-C. I was wondering
I come from a .NET background and just learned Ruby On Rails. My company

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.