Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » How to fix this strong behaviore of MSC compiler & temporary value ?
How to fix this strong behaviore of MSC compiler & temporary value ? [message #44615] Fri, 24 April 2015 12:56 Go to previous message
omari is currently offline  omari
Messages: 265
Registered: March 2010
Experienced Member
Hello:

the code below does not work as expected when compiled with MSC compiler, tested with MSC10/WinXP and MSC12/Win7:


#include <Core/Core.h>

using namespace Upp;

class A 
{
public:
	int x;
	A():x(0)             	{}

	A( A rval_ a) 			{ LOG("from A");x = a.x;}
	A(String const &s) 		{ LOG("from String");}
	operator String() 		{ LOG("to String"); return ""; }
};

A GetA()
{
	A a;
	a.x = 6;
	return a;
}

CONSOLE_APP_MAIN
{
	A a = GetA();	
	DUMP(a.x);
}
 


the output of this test case is :


from A
to String
from String
a.x = 1310556





regards
omari.

[Updated on: Fri, 24 April 2015 13:24]

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: Initialization for Buffer<T>
Next Topic: mingw/gdb troubles
Goto Forum:
  


Current Time: Fri Apr 26 01:25:47 CEST 2024

Total time taken to generate the page: 1.01903 seconds