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++ TheIDE and Library: Releases and ChangeLogs » Quiz: What is wrong with this code?
Re: Quiz: What is wrong with this code? [message #3953 is a reply to message #3951] Tue, 11 July 2006 09:15 Go to previous messageGo to previous message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

luzr wrote on Mon, 10 July 2006 17:16

struct Rect_ {
.....
	Pt     CenterPoint() const              { return Pt((left + right) / 2, (top + bottom) / 2); }
.....
};


...should compute the central point of Rect...

(...fixed).

Mirek


Interesting.. looks fine to me..

Normaly computation of center point looks like:

top + (bottom - top) / 2

but it evaluates to:

top + bottom / 2 - top / 2 =
top / 2 + bottom /2 =
(top + bottom) / 2

Is that bug related to const modifier??
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Some macro enhancements for TheIde
Next Topic: Fixed QuickTabs DnD refreshing problems. Mouse wheel works in tiny bar too now..,
Goto Forum:
  


Current Time: Thu Jun 26 11:36:46 CEST 2025

Total time taken to generate the page: 0.04427 seconds