This works perfectly with root5, but now with root6, it always complain:
18: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
epsName.Form(variable);
^~~~~~~~
…C:107:18: note: treat the string as an argument to avoid this
epsName.Form(variable);
^
“%s”,
I know what it means, but is possible to fix this centrally? From the TString I see what I am doing is valid: void Form(const char* fmt)
Where did you get the Form signature from?
From TString
void Form(const char *va_(fmt), …)
Formats a string using a printf style format descriptor.
So you have removed the “…” from the argument list. Form is like printf, i.e. it parses your input. In your case, it will fail as soon as you have a percent sign (%) in your variable.
@couet Being a lazy physicist… That’s why I asked whether this could be done centrally. @behrenhoff Yes, it seems I do not need Form, “=” works perfect, at least it doesn’t complain. Thanks!
You have to fix it in your code, it cannot be done centrally. The way you did it works most of the time but is very error prone and should therefore be avoided. The warning (note: not an error) even tells you one way to fix it (as demonstrated by Olivier)
“Form” does more than just appending a string. You can do any text formatting.
The usage is different than the simple “=” . As your initial example had “Form” I made a working one with “Form” too …