Click here to Skip to main content
15,922,533 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Performance and footprint of virtual function Pin
Iain Clarke, Warrior Programmer30-Jan-08 22:41
Iain Clarke, Warrior Programmer30-Jan-08 22:41 
GeneralRe: Performance and footprint of virtual function Pin
George_George30-Jan-08 23:05
George_George30-Jan-08 23:05 
GeneralRe: Performance and footprint of virtual function Pin
Iain Clarke, Warrior Programmer30-Jan-08 23:17
Iain Clarke, Warrior Programmer30-Jan-08 23:17 
GeneralRe: Performance and footprint of virtual function Pin
George_George30-Jan-08 23:21
George_George30-Jan-08 23:21 
GeneralRe: Performance and footprint of virtual function Pin
CPallini30-Jan-08 22:44
mveCPallini30-Jan-08 22:44 
GeneralRe: Performance and footprint of virtual function Pin
George_George30-Jan-08 23:02
George_George30-Jan-08 23:02 
GeneralRe: Performance and footprint of virtual function Pin
CPallini30-Jan-08 23:07
mveCPallini30-Jan-08 23:07 
GeneralRe: Performance and footprint of virtual function Pin
Cedric Moonen30-Jan-08 22:44
Cedric Moonen30-Jan-08 22:44 
For points 1 and 2.1: yes, that's correct. As soon as you declare at least one virtual function in your class, a virtual function pointers table will be created and the class will keep a pointer to it, which increases its size.


George_George wrote:
2.2 Are there anything else matters performance?


No, not as far as I know Smile | :) . I don't see anything else that could.


George_George wrote:
2.3 How to find normal function call address can be determined during compile time and virtual function call address can only be determined during runtime?


When a function is not a virtual function, there is no need to "find" the address of the function: whenever the compiler encounter a call to a specific function of a class, it knows that for this specific class, the address of the function is X. Exactly the same way as for global functions. So, it does a direct call to that function.

For a virtual function, it needs to be more intelligent: it's not because I call a function on class Y that it is this one function that needs to be called by the compiler. It is possible that instead the 'compiler' needs to call a function from one of its derivate class (if the class is of that specific type). This is solved by using the virtual table, which is created when the class instance is constructed.

It's quite difficult to explain such things, so I hope my post is clear enough.

Cédric Moonen
Software developer

Charting control [v1.2]

GeneralRe: Performance and footprint of virtual function Pin
George_George30-Jan-08 22:59
George_George30-Jan-08 22:59 
QuestionAlternative to using FindWindow() in OnCopyData() Pin
demxine30-Jan-08 21:52
demxine30-Jan-08 21:52 
GeneralRe: Alternative to using FindWindow() in OnCopyData() Pin
Iain Clarke, Warrior Programmer30-Jan-08 21:59
Iain Clarke, Warrior Programmer30-Jan-08 21:59 
GeneralRe: Alternative to using FindWindow() in OnCopyData() Pin
demxine30-Jan-08 22:14
demxine30-Jan-08 22:14 
GeneralRe: Alternative to using FindWindow() in OnCopyData() Pin
Iain Clarke, Warrior Programmer30-Jan-08 22:28
Iain Clarke, Warrior Programmer30-Jan-08 22:28 
GeneralRe: Alternative to using FindWindow() in OnCopyData() Pin
David Crow31-Jan-08 3:05
David Crow31-Jan-08 3:05 
GeneralRe: Alternative to using FindWindow() in OnCopyData() Pin
Haroon Sarwar30-Jan-08 22:37
Haroon Sarwar30-Jan-08 22:37 
GeneralRe: Alternative to using FindWindow() in OnCopyData() Pin
demxine30-Jan-08 23:40
demxine30-Jan-08 23:40 
GeneralRe: Alternative to using FindWindow() in OnCopyData() Pin
Haroon Sarwar30-Jan-08 23:53
Haroon Sarwar30-Jan-08 23:53 
GeneralRe: Alternative to using FindWindow() in OnCopyData() Pin
David Crow31-Jan-08 3:04
David Crow31-Jan-08 3:04 
GeneralRe: Alternative to using FindWindow() in OnCopyData() Pin
demxine31-Jan-08 14:20
demxine31-Jan-08 14:20 
GeneralRe: Alternative to using FindWindow() in OnCopyData() Pin
David Crow1-Feb-08 3:05
David Crow1-Feb-08 3:05 
QuestionSAPI within Windows SDK? Pin
_NielsB30-Jan-08 20:53
_NielsB30-Jan-08 20:53 
GeneralActiveX control richedit control hides when pressing Alt key Pin
ShilpiP30-Jan-08 20:47
ShilpiP30-Jan-08 20:47 
GeneralRepost + Crosspost = Absolutely No help Pin
Rajesh R Subramanian30-Jan-08 21:11
professionalRajesh R Subramanian30-Jan-08 21:11 
GeneralRe: Repost + Crosspost = Absolutely No help Pin
ShilpiP30-Jan-08 22:00
ShilpiP30-Jan-08 22:00 
GeneralRe: ActiveX control richedit control hides when pressing Alt key Pin
Nitheesh George31-Jan-08 0:38
Nitheesh George31-Jan-08 0:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.