I wonder if my character constant is too long?
cc1: warnings being treated as errors inspect.c: In function 'add_fstab_entry': inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 1 of 'strlen' makes pointer from integer without a cast /usr/include/string.h:399:15: note: expected 'const char *' but argument is of type 'int' inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 1 of 'strlen' makes pointer from integer without a cast /usr/include/string.h:399:15: note: expected 'const char *' but argument is of type 'int' inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 1 of 'strlen' makes pointer from integer without a cast /usr/include/string.h:399:15: note: expected 'const char *' but argument is of type 'int' inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 1 of 'strlen' makes pointer from integer without a cast /usr/include/string.h:399:15: note: expected 'const char *' but argument is of type 'int' inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 1 of 'strlen' makes pointer from integer without a cast /usr/include/string.h:399:15: note: expected 'const char *' but argument is of type 'int' inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 2 of '__builtin_strcmp' makes pointer from integer without a cast inspect.c:847:3: note: expected 'const char *' but argument is of type 'int' inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 2 of '__builtin_strcmp' makes pointer from integer without a cast inspect.c:847:3: note: expected 'const char *' but argument is of type 'int' inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 1 of 'strlen' makes pointer from integer without a cast /usr/include/string.h:399:15: note: expected 'const char *' but argument is of type 'int' inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 2 of '__builtin_strcmp' makes pointer from integer without a cast inspect.c:847:3: note: expected 'const char *' but argument is of type 'int' inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 2 of '__builtin_strcmp' makes pointer from integer without a cast inspect.c:847:3: note: expected 'const char *' but argument is of type 'int' inspect.c:847:36: error: character constant too long for its type inspect.c:847:36: error: character constant too long for its type inspect.c:847:3: error: passing argument 1 of 'strlen' makes pointer from integer without a cast /usr/include/string.h:399:15: note: expected 'const char *' but argument is of type 'int' inspect.c:847:3: error: passing argument 2 of 'strncmp' makes pointer from integer without a cast /usr/include/string.h:146:12: note: expected 'const char *' but argument is of type 'int'
The problem with a low-level language that explicitly trusts the programmer to know what he’s doing (especially when the compiler really doesn’t) is that by default it pretty much has to err on the side of verbosity. Also, nce it falls into the weeds, it makes a ferocious amount of noise before it finally falls into the lake and can’t figure out how to walk any farther.
But I’ll take C in a heartbeat over C++; after 20+ years of pitched battle, I’m convinced that C++ is a myriad of languages rolled into one; the hardest task facing any C++ team is to agree on precisely which C++ they’re using. C++ doesn’t trust the programmer, and “helpfully” imposes a shadowy Order beneath the sheets that becomes more shadowy the longer you try to examine it.
Every modern language, and I’m going back at least as far as Delphi, is a run-from-the-room-screaming reaction to C++.
But yeah; fix line 847 of inspect.c and most of that bloviage should magically Go Away. Poor simple-minded parser…