4 ms·
Could there be a reason to do that? E.g. preventing the format string from accidentally coming from untrusted user data?
by nitrogen 5y ago
Could there be a reason to do that? E.g. preventing the format string from accidentally coming from untrusted user data?
- andreareina 5y agoTechnically, a define is the same as hard-coding the string. Practically, at the point of use a define looks like a variable which might suggest it's ok to use another variable. Now it could take something from untrusted user input and you wouldn't notice.
- spc476 5y agoThe only thing I could think of is a centralized location of all the format strings could make things easier to translate to another language. But as I stated in my post, it's an internal tool; we don't offer it to other customers as something to install, all our developers speak English, and there are other ways to mark strings for translation (at least on Linux, which this currently requires).