We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is there any reason for Serial::available() method not being defined as const?
when in do this:
class SerialTransport { public: ... size_t bytesAvailable() const; ... }; size_t SerialTransport::bytesAvailable() const { return serial_port_.available(); }
i get the error: (in clang) member function 'available' not viable: 'this' argument has type 'const serial::Serial'
(in gcc) error: passing 'const serial::Serial' as 'this' argument of 'std::size_t serial::Serial::available' discards qualifiers [-fpermissive] return serial_port_.available();
but if i define Serial::available() const in serial.cc, serial.h, also in the impl, it compiles.
The text was updated successfully, but these errors were encountered:
Seems like a good idea to me, assuming the underlying implementations are const.
Sorry, something went wrong.
Seems reasonable to me too, but I don't want to break API/ABI, so I labeled it as "Next API Change" and I'll try to do it then.
No branches or pull requests
Is there any reason for Serial::available() method not being defined as const?
when in do this:
i get the error:
(in clang) member function 'available' not viable: 'this' argument has type 'const serial::Serial'
(in gcc) error: passing 'const serial::Serial' as 'this' argument of 'std::size_t serial::Serial::available' discards qualifiers [-fpermissive]
return serial_port_.available();
but if i define Serial::available() const in serial.cc, serial.h, also in the impl, it compiles.
The text was updated successfully, but these errors were encountered: