3 ms·
Well, it's technically incorrect in that same way that system("echo "Hello, World!""); is incorrect - it mixes syntax in a ambiguous/incompatible way. It's
by a1369209993 5y ago
Well, it's technically incorrect in that same way that
system("echo "Hello, World!"");
is incorrect - it mixes syntax in a ambiguous/incompatible way. It's a bit more amenable to silent autocorrect though, so YMMV.
- pabs3 5y agosystem() in general is incorrect, there are much better ways to run other programs, like posix_spawn, fork+exec, libpipeline etc.
- a1369209993 5y agoFor a non-constant argument, sure, but I was talking about the malformed string literal.
- pabs3 5y agoEven for a constant argument; it is better to just start the program than to start the shell and tell it to start the program like system() does. Ack about the string literal.
- lmm 5y agoIt's not. There is a C specification that requires quotes to be escaped within strings; there is no such specification for English. One can write English sentences that require arbitrarily distant pieces of context to be parsed correctly (much like perl, where one can write lines which may or may not be comments based on the state of some other part of the program), and such sentences may be unwise, but are by no means incorrect.