Welcome, Guest. Please login or register.

Author Topic: Probably very basic C question...  (Read 2105 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline ncafferkey

  • Sr. Member
  • ****
  • Join Date: Feb 2003
  • Posts: 387
    • Show all replies
Re: Probably very basic C question...
« on: May 25, 2004, 08:43:24 PM »
If the library didn't open, LibBase would be NULL, which is zero, which is FALSE. If the library did open, it wouldn't be zero, which is TRUE. This all stems from the fact that C isn't type strict and doesn't have a boolean type. A more logical way to do the same thing would be to use:

if(LibBase != NULL)

Any compiler worth its salt will optimise this so that it's no less efficient than the first version.