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

base empty implementation for non-pure virtual functions in HardwareSerial.h #433

Closed
wants to merge 1 commit into from

Conversation

majbthrd
Copy link

Although the GCC 7-2017Q4 presently bundled into the Arduino SAMD v1.8.3 package doesn't complain, more recent compiler versions are not as accommodating. What I've seeing with GCC 8-2018Q4 is:

Uart.o: in function 'HardwareSerial::HardwareSerial()': undefined reference to 'vtable for HardwareSerial'

The Uart class is derived from HardwareSerial, and the compiler error is due to begin() and end() not being pure virtual and not having a base class implementation.

I see two options. One would be to declare begin() and end() as pure virtual (as everything declared in HardwareSerial is). However, I presume there is some latent reasoning by the author to exclude those particular declarations. If we change this, there also seems to be the possibility of breaking someone's code.

The second option would be to provide a base empty implementation for these functions. This satisfies the compiler's need to have a default implementation should the derived classes not implement one.

@aentinger
Copy link
Contributor

I'm closing this since ArduinoCore-API was introduced to ArduinoCore-samd with #560. In ArduinoCore-API those functions in questions are in fact defined pure virtual, as was one of your suggested fixes.

@aentinger aentinger closed this Nov 26, 2020
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.

2 participants