strcasecmp NULL argument; man strcasecmp
I made a small program that sigsegved on strcasecmp, and had no idea why
until I made this test case:
strcasecmp(NULL, "TEST");
which, when compiled, got me the following warning:
test.c:9:4: warning: null argument where non-null required (argument 1)
[-Wnonnull]
However, man strcasecmp doesn't say anything about NULL arguments, could
someone please explain how I could deduce this theoretically from reading
documentation, as opposed to empirically writing test cases? Is it a
deeper-rooted standard? Or maybe const char * doesn't have the right to be
NULL, for some reason I don't know?
No comments:
Post a Comment