Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 753473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:54:05+00:00 2026-05-14T14:54:05+00:00

Something really weird is happening: when I call foo(100*1.0f), somewhere along the line that

  • 0

Something really weird is happening: when I call foo(100*1.0f), somewhere along the line that becomes 0. To verify I put a breakpoint on foo(), and it indeed is zero and it indeed gets called with 100*1.0f. The code is in Obj-C++.

Here is the calling function in XCode’s GDB frontend, as you can see, score*scoreMultiplier is 100.
Calling Function http://img341.imageshack.us/img341/1109/screenshot20100502at135.png

void JNPP1PGameController::addScoreToPlayer(NSInteger score) {
    if(!gameOver){
        JNLogString(@"Adding score(%d*%f) to player", score, scoreMultiplier);
        [player addScore: score*scoreMultiplier];
        [wrapper setShouldNotify];
        [wrapper notify];
    } else {
        JNLogString(@"Not adding score(%d*%f) because GAME IS OVAR", score, scoreMultiplier);
    }
}

And here is the called function in XCode’s GDB frontend, here _score is 0.
Called Function http://img156.imageshack.us/img156/1109/screenshot20100502at135.png

- (void) addScore:(NSInteger) _score {
    score += _score;
    JNLogString(@"Player can has %d points.. HURRAY!!!", score);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:54:05+00:00Added an answer on May 14, 2026 at 2:54 pm

    The code was fixed by changing the calling code to this:

    void JNPP1PGameController::addScoreToPlayer(NSInteger score) {
        if(!gameOver){
            JNLogString(@"Adding score(%d*%f) to player", score, scoreMultiplier);
            NSInteger _score = score*scoreMultiplier;
            JNLogString(@"This is the case: %d", _score);
            [player addScore: _score];
            [wrapper setShouldNotify];
            [wrapper notify];
        } else {
            JNLogString(@"Not adding score(%d*%f) because GAME IS OVAR", score, scoreMultiplier);
        }
    }
    

    I assume now something went wrong with casting to a undefined (I got a “method not found” warning) parameter type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Something really weird is happening on my website, there is an image that is
Something really weird is happening, it works when I document.write() outside the window.onload =
Something really weird is happening to my Rails app. For some strange reason, jQuery
So I've got something really weird going on here, and can't quite put my
I'm trying to do something really simple, but starting to realize that dates in
OK, I realize that question might seem weird, but I just noticed something that
I have a really weird situation. The idea is there is a scroller that
I have a really weird thing happening in my wpf application. Every time I
Something really weird has happened to my source code. The application always built successfully,
Something really weird is going on with Xcode and an iPhone project I'm working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.