Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constification of methods #15

Merged
merged 2 commits into from Dec 29, 2015
Merged

constification of methods #15

merged 2 commits into from Dec 29, 2015

Conversation

umlaeute
Copy link

methods handling with device-names should really use const char* for the device names (both as an argument and as a result)

when using C++, we often deal with std::string rather than "char*"

thus, the device-name will often be passed as "s.c_str()", which really
is a "const char*".

to avoid warnings, it would be good if videoInput::getDeviceIDFromName()
would accept "const char*".

note: this probably breaks ABI compatibility!
in this case it might be better to overload this member:
  int videoInput::getDeviceIDFromName(const std::string&name);
since the result of getDeviceName() is really a pointer to a static
array, the caller should (must) never change these values.
they should therefore declared "const".
@ofTheo
Copy link
Owner

ofTheo commented Dec 29, 2015

thanks!

ofTheo added a commit that referenced this pull request Dec 29, 2015
constification of methods
@ofTheo ofTheo merged commit 22356ca into ofTheo:master Dec 29, 2015
@umlaeute umlaeute deleted the const branch December 29, 2015 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants