New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Warning :suggest parentheses around assignment used as truth value

Post Reply New Thread Subscribe

Thread Tools

Member Since: Oct 27, 2008
Posts: 13
roublesaha is on a distinguished road

roublesaha is offline
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..

QUOTE Thanks

Member Since: Mar 15, 2007
Posts: 161
mystic_fm will become famous soon enough
Mac Specs: 17" MacBook Pro, 2.33GHz C2D, 2GB RAM

mystic_fm is offline
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.)
QUOTE Thanks

SpaceTeaBoo's Avatar
Member Since: Jan 07, 2009
Location: USA
Posts: 4
SpaceTeaBoo is on a distinguished road
Mac Specs: SpaceTeaBoo

SpaceTeaBoo is offline

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
QUOTE Thanks

Post Reply New Thread Subscribe

« Question about Input/Output Streams (sockets) | how to add url in iCal »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
Leopard Gone Very Slow on iBook chuckalicious OS X - Operating System 4 12-31-2007 04:58 PM
first mac , i'm not pleased lilmill Switcher Hangout 34 12-17-2007 09:05 PM
error message during weekly maintenance ajresovsky Schweb's Lounge 0 06-18-2006 05:11 PM

All times are GMT -4. The time now is 06:07 AM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?