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  |
 |
deep
Messages: 266 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   |
 |
deep
Messages: 266 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
|
|
|
|
Goto Forum:
Current Time: Fri Apr 25 11:55:57 CEST 2025
Total time taken to generate the page: 0.00735 seconds
|