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 » Know what you're using. Size of some common types.
Re: Know what you're using. Size of some common types. [message #57986 is a reply to message #57981] Sun, 09 January 2022 20:36 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 534
Registered: March 2007
Contributor
If the intended modified Button will continue to be a Ctrl derivative so that it works seamlessly with existing code, the minimum size it will have is sizeof(Ctrl). In this particular situation, the Ctrl member variable LogPos(and maybe more candidates) can be done without, we can reuse it to put a Style * st; and probably WhenPush event variable somewhere else. In any case, the minimum size will be sizeof(Ctrl). The savings won't be quite as good (significantly less than the case when buttons or even frames are ridden of), even though it indeed involves least work and least chance of surprise.

Another way is to define it something like
class FakeButton 
{
public:
   void Paint(Draw& w, Rect& where, Button::Style& style, int state/*normal,hot,pressed,disabled*/);

   Event<> WhenPush;
};


This way sizeof(FakeButton)==sizeof(Event<>)(==sizeof(void*) ), but the effort involved in revising containing Ctrl (ScrollBar, EditWithSpin, DropList, etc)'s Paint,LeftDown,LeftRepeat, etc, will be quite similar to hardcoding each of the Ctrl's method that we need to change to allow the savings to take place.


[Updated on: Sun, 09 January 2022 20:43]

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
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: [SOLVED][Question] Is anyone able to build UPP and Binaries based upon it as 32-Bit?
Next Topic: Source Code Efficiency Minor Issue
Goto Forum:
  


Current Time: Sun Jun 16 20:16:20 CEST 2024

Total time taken to generate the page: 0.02809 seconds