Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [T-Merge patch] syncing code for views

Project highlights: :. Download .: :. Support .: :. FAQ .: :. Translations .: :. Donate .: :. Report Bug .:

Discussion topic

Back to topic list

Re: [T-Merge patch] syncing code for views

Author steveking
Full name Stefan Küng
Date 2011-04-06 09:26:00 PDT
Message On 05.04.2011 23:09, Oto BREZINA wrote:
> On 2011-04-05 20:03, Stefan Küng wrote:
>> On 04.04.2011 22:57, Oto BREZINA wrote:
>>> Theme of patch: syncing code of BottomView.cpp, LeftView.cpp,
>>> RightView.cpp for later refactor common part to (BaseView.cpp)
> (same theme) part 2 attached : LeftView: extracting code from switch
> into functions; RightView add spaces to match LeftView formating;
> BaseView remove commented block defining WM_MOUSEHWHEEL fo pre 600 wins
>>> popup.AppendMenu(
>>> UINT nFlags,
>>> UINT_PTR nIDNewItem = 0,
>>> LPCTSTR lpszNewItem = NULL )
>>> 1. Is there any real gain to do not use nIDNewItem same value as IDS ?
>> That depends on whether we trust the optimizations of the compiler :)
>> If we use the IDS values, then the switch() could take up a lot of space
>> since those values are not continuous or even in the same value range.
>> Sure, we could edit the resource.h file manually to make sure those IDS
>> values are as we would like them, but I don't like messing with
>> generated files.
> we are talking about user action response - called rare, with up to ten
> values. No big deal, but I will keep in mind ...

It's not a performance issue but a code size issue. The switch-case
statement is converted into a jump table, and if the values are far
apart, that jump table gets really big. And we have to trust the
optimizer to decide in such cases that a jump table isn't the right
thing to do but better convert the switch-case to if-else statements.


   oo // \\ "De Chelonian Mobile"
  (_,\/ \_/ \ TortoiseSVN
    \ \_/_\_/> The coolest Interface to (Sub)Version Control
    /_/ \_\ http://tortoisesvn.net

« Previous message in topic | 4 of 27 | Next message in topic »


Show all messages in topic

                     Re: [T-Merge patch] syncing code for views steveking Stefan Küng 2011-04-10 12:35:07 PDT
                         Re: [T-Merge patch] syncing code for views otik Oto BREZINA 2011-04-10 12:44:39 PDT
Page: of 2 « Previous | Next »
Messages per page: