Member function defs in customviews.h | VSTGUI4 | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Member function defs in customviews.h
Avatar
Nova Scotia, Canada
Admin
August 17, 2020 - 4:01 am
Member Since: July 7, 2020
Forum Posts: 3
sp_UserOfflineSmall Offline

In working through ASPiK's custom messaging code for KnobViewController, I see that KnobViewController::valueChanged() is defined in the customview.h file rather than in customview.cpp. I'm tempted with my own custom object to merely declare it in the header file and put its definition in the CPP file, but I'm wondering if this might be a bad idea because there are performance reasons why this shouldn't happen? Since I'm wanting to build a plugin that can run on a variety of hardware platforms, I feel I can't answer this question sufficiently just by testing it on my own system. Is there a strong reason why this function is written in such a way as to encourage the compiler to inline it, or can I move this definition (and that of other member functions such as verifyView() and the ctor and dtor) to the CPP file in my own code without fear?

Thanks,

VariableCook

Avatar
Admin
October 21, 2020 - 10:00 am
Member Since: January 29, 2017
Forum Posts: 697
sp_UserOfflineSmall Offline

You can use either the .h or .cpp definition - your choice. 

I almost always "inline" my .h functions, and if they are really short (like 2 or 3 lines of code) I don't think there is a big difference. But it has been an eternity since I did any performance testing with that.

Will 

Forum Timezone: America/New_York

Most Users Ever Online: 152

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Chaes: 56

Skyler: 48

StevieD: 46

Derek: 46

Frodson: 45

Peter: 43

TheSmile: 43

Nickolai: 43

clau_ste: 39

jeanlecode: 37

Member Stats:

Guest Posters: 2

Members: 786

Moderators: 1

Admins: 6

Forum Stats:

Groups: 13

Forums: 42

Topics: 852

Posts: 3382

Moderators: W Pirkle: 697