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 » U++ Library support » U++ Core » Cannot use Format for unsigned int
Cannot use Format for unsigned int [message #47946] Wed, 26 April 2017 07:18 Go to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Hi

Using Win10, MSC15
UPP10943

#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	int n;
	unsigned int un;
	String s;
	
	n = 1212;
	un = 0x05060708 ;
	
	DUMP(n);
	DUMP(un);
	
	s << Format("%08X" , n) << "\n";
	s << Format("%08X" , un) ;

	DUMP(s);
	
}


I get compile time error
'Upp::Format': none of the 45 overloads could convert all the argument types
for unsigned int variable un

TestFormat.cpp(18): error C2665: 'Upp::Format': none of the 45 overloads could convert all the argument types
\upp\uppsrc\core\Format.h(111): note: could be 'Upp::String Upp::Format(const char *,const Upp::Vector<Upp::Value> &)'
\upp\uppsrc\core\Format.h(106): note: or       'Upp::String Upp::Format(const char *,const Upp::Value &)'
\upp\uppsrc\core\TimeDate.h(154): note: or       'Upp::String Upp::Format(Upp::Time,bool)'
\upp\MyApps\TestFormat\TestFormat.cpp(18): note: while trying to match the argument list '(const char [5], unsigned int)'
TestFormat: 1 file(s) built in (0:04.82), 4828 msecs / file, duration = 4844 msecs, parallelization 0%


MinGW error
error: conversion from 'unsigned int' to 'const Upp::Value' is ambiguous
s << Format("%08X" , un) ;


Warm Regards

Deepak
Re: Cannot use Format for unsigned int [message #47947 is a reply to message #47946] Wed, 26 April 2017 07:27 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Hi

Looking at Value.cpp code I see there is no unsigned types.
This may be the cause.

How to add "unsigned int" -- uint32 and uint64

void Value::RegisterStd()
{
	ONCELOCK {
		Value::Register<WString>("WString");
		Value::Register<Complex>("Complex");
		Value::Register(VALUEARRAY_V, ValueArrayDataCreate, "ValueArray");
		Value::Register(VALUEMAP_V, ValueMapDataCreate, "ValueMap");
		Value::AddName(STRING_V, "String");
		Value::AddName(INT_V, "int");
		Value::AddName(DOUBLE_V, "double");
		Value::AddName(VOID_V, "void");
		Value::AddName(DATE_V, "Date");
		Value::AddName(TIME_V, "Time");
		Value::AddName(INT64_V, "int64");
		Value::AddName(BOOL_V, "bool");
		Value::AddName(ERROR_V, "error");
	};
}


Warm Regards

Deepak
Re: Cannot use Format for unsigned int [message #47949 is a reply to message #47947] Wed, 26 April 2017 08:34 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Format("%08X", (int)((dword)INT_MAX + 20))


Mirek
Previous Topic: How to bind parameter to PostCallback with Function, Event object
Next Topic: StringStream has Put,but no Remove funcs
Goto Forum:
  


Current Time: Thu Mar 28 23:59:06 CET 2024

Total time taken to generate the page: 0.00926 seconds