Hacker News new | past | comments | ask | show | jobs | submit login

That's fine in isolation, but mixing that inside a comma-separated list is not a good idea.



I agree, but that's a matter of style. It's technically correct. I did say pedantic.


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.


It'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.


system() in general is incorrect, there are much better ways to run other programs, like posix_spawn, fork+exec, libpipeline etc.


For a non-constant argument, sure, but I was talking about the malformed string literal.


Even 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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: