Does the compiler calls empty functions (subs)

nowhere91080

New member
Joined
Apr 18, 2006
Messages
2
Programming Experience
3-5
Hello,
does anybody know, how the compiler handles empty functions? I have functions defined in interfaces without inheritance, but they are empty in many cases in the implementation. Is the compiler intelligent enough to recognize, that he don't need to call the function?
I don't know, where to search for in the MSDN :(

Thanks for any answers
Totti
 
Thank you. Exactly that was my problem. I didn't know if it affects the performance, when I call empty subs. You said "Otherwise if you call the empty functions but they return nothing": Did you mean the keyword "nothing"?
If I call a VB.NET function:

public function xyz() as MyClass
return nothing
end function

What happens now? Does the function overhead influence the performance or ist the function call replace with "nothing" by the compiler?

Yes, no or "I don't know" is enough ;)
Thanks again
 
Think about what you're asking. If you call a function then it will be called at run-time. There is no replacement. The function is called. Having said that, how long do think it would take a modern computer to execute that function? It could probably be done thousands of times before a hummingbird could beat its wings once.

The real question is: why are you implementing interfaces and not providing implementations for their members? Sounds to me like you might need to rethink your design.
 
Back
Top