You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a bool flag, giving the option multiple times on the command line causes a conversion error (because it can not count the number of times the option appears in a bool variable, I presume).
But that error message is ugly and user-unfriendly, so why would anybody ever use that? Which means everybody will just use an int and check for == 0.
Why not just keep the value at true and ignore the extraneous appearances of the bool flag on the command line?
My (original) thinking is that int means multiple flags and bool one; you could then do: if(flag) to see if there are one or more. However, I think you are probably right. It's uncommon to want multiple flags to fail, and custom logic could be added to the int versions or the callback version.
The way this works in GNU projects is that sometimes there is a corresponding --no-FLAG option that sets it to false, and the last one of --foo, --no-foo on the command line wins.
When using a bool flag, giving the option multiple times on the command line causes a conversion error (because it can not count the number of times the option appears in a bool variable, I presume).
But that error message is ugly and user-unfriendly, so why would anybody ever use that? Which means everybody will just use an int and check for == 0.
Why not just keep the value at true and ignore the extraneous appearances of the bool flag on the command line?
Test case is in AppTest.cpp:156:
The text was updated successfully, but these errors were encountered: