On Fri, Aug 09, 2019 at 03:10:51PM +0800, Chuhong Yuan wrote: > strncmp(str, const, len) is error-prone because len > is easy to have typo.
I'm thinking that is exactly the easy case for compilers/semantic checkers to verify. Now granted, GCC doesn't seem to do that by itself, but still. I'd buy your argument if the prefix is variable, because in that case you can do prefix matching cheaper than strlen+strncmp, but as is, not really.