Victor A. Wagner Jr. a écrit :
>>>>
>>>> /// Now that we've done the preliminaries, the main program is dead
>>>> simple
>>>> int main(int argc, char* argv[])
>>>> {
>>>> /// make sure we have something to score (argc will be at
>>>> least 1 because the
>>>> /// name of the program (as invoked) is put into argv[0] so
>>>> there is at least
>>>> /// one thing in the argv[] array
>>>> if (argc < 2)
>>>> {
>>>> /// no args... show the way to use the program
>>>> cout << "Usage: " << *argv << " word[ word]...\n";
>>>>
>> may be a return 1; here
>>
>
> could be... I didn't really consider it an error
> as such. I often run my command line utilities
> with NO arguments to get reminded what the args
> and options are (no options here, of course)
>
>
The same.
But I change my mind in my production environnement when a day
we changed the args used to launched an exe within a .sh, so the exe
silenty return 0 to the sh
but do nothing else print the notice. Now, I prefer to distinguish
between -? or --help wich are
notice calling and empty call which can be invalid or valid (depend on
the exe).
David