Advertisement Jump to content
Sign in to follow this  
noatom

Function call is jumped!

This topic is 1785 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

class Manager{

private:

	Manager() {};
	Manager(Manager const&) {};
	void operator=(Manager const&) {};


	
public:
	static Manager& getInstance();
        void Initialize();
};

Manager& Manager::getInstance(){
	static Manager x;
	return x;
}
void Manager::Initialize() { cout << "test" << endl; }

So all I'm doing is: Manager::GetInstance().Initialize(); but the call is never made! I used the visual studio debugger and when I try to enter the function is just skips it!

Share this post


Link to post
Share on other sites
Advertisement

I don't believe you ;)

 

You have Manager::getInstance but no Manager::GetInstance

 

I'm guessing that's a typo though.

 

Are you calling it from a global constructor? Have you tried splitting it into 2 separate calls (i.e. Manager& theMan = Manager::getInstance(); theMan.Initialize();) ?

Share this post


Link to post
Share on other sites

EDIT: garbage post deleted. Still on my morning coffee.

 

To put something readable here: A copy and paste of your code and call works fine for me.

Edited by Buckeye

Share this post


Link to post
Share on other sites

Heh stop bashing your heads with this, I just disabled the optimizations in Visual Studio and it worked. I'm not really sure what kind of optimizations VS does if it excluded a function call like that but... that's it.

Share this post


Link to post
Share on other sites

That's not a fix. Disabling optimisation is not something you want to be doing.

Have you tried rebuild all?

 

Did you jut miss the message because the program exited before you saw it (and setting breakpoints in release mode can be a bit hit and miss I suppose).

Share this post


Link to post
Share on other sites

Heh stop bashing your heads with this, I just disabled the optimizations in Visual Studio and it worked. I'm not really sure what kind of optimizations VS does if it excluded a function call like that but... that's it.


Inlining.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!