Why: char *label vs const char *label #2552
Closed
marcelstoer
started this conversation in
General
Replies: 1 comment 1 reply
-
Yes, there are a few cases where this warning appears, so I need to update these instances at some point. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Your element constructors use
char *label
rather thanconst char *label
e.g. https://github.com/Bodmer/TFT_eSPI/blob/master/Extensions/Button.h#L16. Why is that so?Hence, instead of passing a string literal created inline/on-the-fly I need to create a
char[]
.--> the compiler complains "warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]"
To quiet it, I need to use something like this.
Beta Was this translation helpful? Give feedback.
All reactions