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 » FIX: UPP::Scan returns int64 for INT_V
Re: FIX: UPP::Scan returns int64 for INT_V [message #32019 is a reply to message #31995] Sun, 17 April 2011 14:57 Go to previous messageGo to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
could you provide the link to the thread? couldnt find it..

i understand, that for best/secure performance ConvertInt should be able to keep the *parsed* data type as complete as possible (int64, if enough info provided from string), even if 'later' in usage the int64 is downgraded to int.

but then, the problem should be solved in EditInt, because, at most, there, one could expect to have a true int value returned. but it is not easy, since EditInt is a EditMinMax<> typedef.

i took a look in the code again. the int64 seems to be there to be able to perform range test after conversion, and return ErrorValue. there is also the solution to the problem. if no error, the range is ok and an int can be generated.

Value ConvertInt::Scan(const Value& text) const {
	Value v = UPP::Scan(INT_V, text);
	if(IsError(v)) return v;
	if(IsNull(v)) return notnull ? NotNullError() : v;
	int64 m = v;
	if(m >= minval && m <= maxval) return int(m);//v; <====
	return ErrorValue(UPP::Format(t_("Number must be between %d and %d."), minval, maxval));
}

[Updated on: Sun, 17 April 2011 15:30]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Rect_<T>::SetNull not correct for Rectf (Rect_<double>)
Next Topic: Ptr improve
Goto Forum:
  


Current Time: Sat Jul 19 04:23:15 CEST 2025

Total time taken to generate the page: 0.03462 seconds