-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
SD library: Declare path parameter on all functions as const
#3998
Conversation
This way we will avoid some warnings when using paths as constants in #define's `warning: deprecated conversion from string constant to 'char*'`
@ArduinoBot build this please |
Another signature method in the library that should be changed as well is I didn't do the change because it may break existing code, although it should be fixed easily. For example: File file = File("test.txt");
char* name = file.name();// now it compiles, but it won't after we add that const
const char* name = file.name();// valid after proposed change on this comment done (and before the change, too) May I update the pull request and add that change? |
@Ivan-Perez , of course you can update the PR by pushing another commit on the top of your topic branch 😄 |
Thank you! About the breaking change in file.name(); I'd avoid it (unless there is a stronger reason to do it anyway that I'm missing). |
Maybe on the next major release the change can be included. It's not an important change though, but for correctness that variable should be returned as const. If you think the change is ok I can prepare another PR now so you can merge it whenever you want. Thanks!! |
Probably related to this, the 1.6.6 IDE insists that the SD and Servo libraries are out of date, and even if you let the library manager update them, the error persists. |
@tigoe I had the same issue. I found it was caused by the copies of these libraries in the Mighty 1284P 3rd party hardware core I have installed. It only happens when I have one of the Mighty 1284P boards selected. The solution I found is here: JChristensen/mighty-1284p#23. So even if you don't have Mighty 1284P installed you might be having a similar problem. |
I don't but you're right that it may be related to particular libraries, as I was able to get the redBear labs libraries to install just fine. Thanks, |
This way we will avoid some warnings when using paths as constants in #define's.
For example:
Raises this warning using the
-Wwrite-string
option of compiler:warning: deprecated conversion from string constant to 'char*'
After adding those
const
, this warning desappears.Existing code is not affected by these minor changes in any case.