You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So @abrahamavnisan brought up a question as to why, in the openFrameworks documentation, certain functions have their inputs defined with the const keyword (e.g. ofStringSplit() takes a "const string& str" as an input).
I was looking up something else and stumbled upon an explanation of const correctness. Short version - it guarantees that, if we are passing in a variable to a function, that our copy of the variable will be unaffected by the function call. Very important information for us since we are using someone else's (oF) function, and we aren't familiar with how it is implemented: whatever happens behind the scenes, we can rest assured that the function won't muck with our variables.
The text was updated successfully, but these errors were encountered:
@mikewesthad you've got the basics (and most important bits).
This is a whole can of worms that you've discovered. I'll be happy to give you the low-down on const-correctness tomorrow and how it is ... not well-demonstrated in the openFrameworks core (yet). Just make sure to remind me if I don't remember tomorrow. We are going to get into some pointers, references, const, etc tomorrow.
See here for some of my pending work on const-correctness in the oF core ....
Also, this may be of interest. It's the 1.0 Roadmap we created in Japan at the end of the summer. It mentions the need for const-correctness throughout the core.
So @abrahamavnisan brought up a question as to why, in the openFrameworks documentation, certain functions have their inputs defined with the const keyword (e.g. ofStringSplit() takes a "const string& str" as an input).
I was looking up something else and stumbled upon an explanation of const correctness. Short version - it guarantees that, if we are passing in a variable to a function, that our copy of the variable will be unaffected by the function call. Very important information for us since we are using someone else's (oF) function, and we aren't familiar with how it is implemented: whatever happens behind the scenes, we can rest assured that the function won't muck with our variables.
The text was updated successfully, but these errors were encountered: