Recently a student in a CS lab I TA was ranting about how confusing it was that argv[0] was not the first argument but the command you ran instead (kind of like when they rant about how “stupid” it is that they have to write x == 2 or x == 4 instead of x == 2 or 4 in python), and asked me why they did it. Well, I honestly had no idea why. I don’t see any practical purpose to knowing what command was used to execute your program nor a problem with passing an empty list/vector, and google didn’t help to resolve this question either.
So my question is why is the executed command itself included in the list/vector of command line arguments?
Knowing the command line can influence the way the program behaves. As a famous example,
bashbehaves like the classicshif you call it as such (for example using a softlink). Busybox also comes to mind (it really makes heavy use of it).