Results 1 to 3 of 3
  1. #1

    Member Since
    Oct 27, 2008
    Warning :suggest parentheses around assignment used as truth value
    I am using this snippet of code

    void * handle_;

    if (handle_ =dlopen("/System/Library/Frameworks/DiskArbitration.Framework/Versions/A/DiskArbitration",RTLD_NOW))

    else if (handle_ =dlopen("/System/Library/PrivateFrameworks/DiskArbitration.Framework/Versions/A/DiskArbitration",RTLD_NOW))

    But i am getting the warning :
    "suggest parentheses around assignment used as truth value" for the first line i,e the for the "for" loop....can somebody help me to get rid of this warning..

  2. #2

    Member Since
    Mar 15, 2007
    17" MacBook Pro, 2.33GHz C2D, 2GB RAM
    Two ways to handle this:

    1) Change the line(s) to make the assignment result's participation in a boolean expression explicit, i.e. "if ((bool)(handle_ = dlopen()) == true)". Actually just the extra pair of parens would suppress the warning, but that would be ugly code in my opinion ... it's better to demonstrate that you are deliberately making an assignment and then comparing the result to a boolean value.

    2) If you prefer the original, more terse version of the code, you can go into the Build options on the target executable, search for "parentheses" under GCC Warnings, and unselect that checkbox for all configurations. (This is for Xcode 3.1.1, but I assume that earlier versions probably had a similar build option.)

  3. #3

    SpaceTeaBoo's Avatar
    Member Since
    Jan 07, 2009
    Medical Education questions

    I need some help. Is here anybody who studies at Medic school or a college or may be university. May be somebody knows some sites of medic school material
    I need some texts about health care, different catigories ex mental health, women health and other. I should make my study soon. Please help me to find some info. And it should be information that google cant find, cos my teacher kill me for that.

    Thanks for help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 10
    Last Post: 10-19-2011, 11:02 PM
  2. Application assignment issues.
    By mephron in forum OS X - Operating System
    Replies: 2
    Last Post: 12-30-2009, 06:35 AM
  3. Parallel's Virtual Core and Ram assignment
    By Dsnray in forum Running Windows (or anything else) on your Mac
    Replies: 4
    Last Post: 09-16-2009, 09:32 PM
  4. Assignment due using Windows.exe applications
    By verbatim210 in forum Running Windows (or anything else) on your Mac
    Replies: 36
    Last Post: 08-19-2007, 04:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts