• 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: Mon, 24 Sep 2007 22:17:23 -0400


On Sep 24, 2007, at 10:45 AM, Scott Ribe wrote:

Given the definition of collision_check above, exactly when do you
expect it to return false? Since you don't actually return anything
from collision_check() it always returns true, so tile_down() will also.

Close, but no cigar ;-)

the address of 'bool tile_right()', will always evaluate as 'true'

This warning means that you're using the address of the function instead of
calling it. In other words, you're doing something like:


 if (tile_down)

When you meant to do something like:

if (tile_down())

He had:

if (!collision_check())

collision_check() was just a stub function in the code he posed:

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

Because the code in collision_check() doesn't return anything, it seems to default to returning 32 when I tested it, not the address. I admit not being enough of a C or C++ guru to know why not returning a value generates a warning instead of an error, or why it returns 32.

Not that I want the cigar, because I don't smoke. ;-)

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: 
 >Re: Weird error situation (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: Question about loading external image
  • Next by Date: Re: Weird error situation
  • Previous by thread: Re: Weird error situation
  • Next by thread: Re: Weird error situation
  • Index(es):
    • Date
    • Thread