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

warning: type qualifiers ignored on function return type [-Wignored-qualifiers] #7

Open
noiasca opened this issue Jan 20, 2024 · 0 comments

Comments

@noiasca
Copy link

noiasca commented Jan 20, 2024

The library produces two warnings with Arduino UNO in Arduino IDE 1.8.19

`C:\Daten\myrepository\Arduino\libraries\PString/PString.h:56:10: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
inline const size_t length()
^~~~~

C:\Daten\myrepository\Arduino\libraries\PString/PString.h:60:10: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
inline const size_t capacity()
^~~~~
`

As code you can use the example test_pstring

According https://stackoverflow.com/questions/1134237/pedantic-gcc-warning-type-qualifiers-on-function-return-type a return type should not be const as the return value can be dynamic. At least for length() this makes sense.

Issue could be solved when keyword const gets removed.

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

No branches or pull requests

1 participant