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 » Community » Newbie corner » VectorMap Get() on Unknow value return 23
VectorMap Get() on Unknow value return 23 [message #54847] Mon, 21 September 2020 14:26 Go to next message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
I have this kind of code :

#include <Core/Core.h>
using namespace Upp;

CONSOLE_APP_MAIN
{
	VectorMap<String, unsigned int> test;
	
	test.Add("t1") = 2;
	try{
		//Work correctly
		Cout() << test.Get("t1") << EOL;
				
		//Raise assertion in debug mode
		//Print 23 in release mode (CLANGX64)
		//Print 0 in release mode (MSVS19x64)
		Cout() << test.Get("t2") << EOL;
	}catch(Exc& e){
		Cout() << e << EOL;
	}catch(...){
		Cout() << "Catched" << EOL;
	}
}



For Strange reason, test.Get("t2") print 23 in release mode when using CLANGx64, why ?
Re: VectorMap Get() on Unknow value return 23 [message #54848 is a reply to message #54847] Mon, 21 September 2020 17:03 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Xemuth wrote on Mon, 21 September 2020 14:26
I have this kind of code :

#include <Core/Core.h>
using namespace Upp;

CONSOLE_APP_MAIN
{
	VectorMap<String, unsigned int> test;
	
	test.Add("t1") = 2;
	try{
		//Work correctly
		Cout() << test.Get("t1") << EOL;
				
		//Raise assertion in debug mode
		//Print 23 in release mode (CLANGX64)
		//Print 0 in release mode (MSVS19x64)
		Cout() << test.Get("t2") << EOL;
	}catch(Exc& e){
		Cout() << e << EOL;
	}catch(...){
		Cout() << "Catched" << EOL;
	}
}



For Strange reason, test.Get("t2") print 23 in release mode when using CLANGx64, why ?


Not strange of all. It is undefined behaviour, anything can happen there...

Mirek
Previous Topic: C# - dotNet conversion
Next Topic: submenu of submenu
Goto Forum:
  


Current Time: Fri Apr 19 14:19:01 CEST 2024

Total time taken to generate the page: 0.10058 seconds