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 » AString::Compare missing explicit return value (q will = 0 if the loop isn't broken. This value should be returned explicitly.)
AString::Compare missing explicit return value [message #44081] Tue, 23 December 2014 10:56 Go to previous message
rainbowsally is currently offline  rainbowsally
Messages: 29
Registered: December 2014
Promising Member
For x86-based C/C++, the eax/rax register is usually returned by default (for int types) and this is probably the register holding 'q' below, but it can't be counted on.

File: uppsrc/Core/AString.hpp
template <class B>
int AString<B>::Compare(const tchar *b) const
{
	const tchar *a = B::Begin();
	const tchar *ae = End();
	for(;;) {
		if(a >= ae)
			return *b == 0 ? 0 : -1;
		if(*b == 0)
			return 1;
		int q = cmpval__(*a++) - cmpval__(*b++);
		if(q)
			return q;
	}
	// -rs added 1 line to explicitly return q(=0)
	return 0;
}


 
Read Message
Read Message
Read Message
Previous Topic: CbGen not compiling in linux.
Next Topic: Multithreaded Animated GIF
Goto Forum:
  


Current Time: Sat Apr 27 15:04:19 CEST 2024

Total time taken to generate the page: 0.08008 seconds