• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Weird error situation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird error situation


  • Subject: Re: Weird error situation
  • From: Laurence Harris <email@hidden>
  • Date: Tue, 25 Sep 2007 17:46:05 -0400


On Sep 24, 2007, at 12:57 AM, Adam wrote:

...but I have #pragma once at the top! Doesn't that pretty much fix the problem? I used Cris Suter's advice and slapped an "extern" on the ones that it said were having a problem, and bingo! it's fixed. The only thing now is that it's giving me warnings about some bool functions that I have:

[snip]

/Users/atg/Desktop/Projects/Programming Project/Builds/ Basic_SDLOGL_001/Sources/sdl_tetris_002.cpp:111: warning: the address of 'bool tile_down()', will always evaluate as 'true'
[snip]


Here's the code:

bool collision_check()
{
	//if something's in the way return false otherwise return true
}

bool tile_down()
{
	next_piece = curr_piece;
	next_piece.y--;
	if (!collision_check())
	{
		return false;
	}else
	{
		return true;
	}
}

If collision_check returns false then tile_down should also return false! ... right?

I just realized that Scott was right in his assessment after he sent me something privately (thanks, Scott). I had previously answered your question, but your question isn't actually related to the warning. The warning is being generated by code you haven't included here. The warning says "the *address* of 'bool tile_down()', will always evaluate as 'true'." So somewhere else in code we aren't seeing here there must be something like:


if ( tile_down )

instead of:

if ( tile_down() )

The first is using the address of the function (which is never 0 and hence always interpreted as true), while the second is using the return value of the function. This warning is there specifically to point out cases where the parentheses were left off unintentionally.

Larry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Weird error situation (From: Adam <email@hidden>)
 >Re: Weird error situation (From: Chris Espinosa <email@hidden>)
 >Re: Weird error situation (From: Adam <email@hidden>)
 >Re: Weird error situation (From: Chris Espinosa <email@hidden>)
 >Re: Weird error situation (From: Adam <email@hidden>)
 >Re: Weird error situation (From: Chris Espinosa <email@hidden>)
 >Re: Weird error situation (From: Adam <email@hidden>)
 >Re: Weird error situation (From: Chris Espinosa <email@hidden>)
 >Re: Weird error situation (From: Adam <email@hidden>)

  • Prev by Date: Re: Objective C++ and ObjC exceptions
  • Next by Date: Including Headers in a Carbon Framework
  • Previous by thread: Re: Weird error situation
  • Next by thread: Oops, re: above
  • Index(es):
    • Date
    • Thread