3 ms·
Apparently it is safe http://stackoverflow.com/questions/448563/am-i-correct-that-strcmp-is-equivalent-and-safe-for-literals http://stackoverflow.com/questions
by raverbashing 13y ago
Apparently it is safe
http://stackoverflow.com/questions/448563/am-i-correct-that-strcmp-is-equivalent-and-safe-for-literals http://stackoverflow.com/questions/448563/am-i-correct-that-...
However, some people may have the temptation of, when changing the code, replacing it with a non-literal string, or, in a rare case, there's a memory corruption affecting the literal string making it lose the null-termination.
- poolpOrg 13y agoso there's a bug if someone is tempted to modify it and break otherwise correct code ? i'd be tempted to say that we can apply the same logic to about 100% of code ever written.
- raverbashing 13y agoNot a bug, but some warning comment might be useful.