I recently started using arguments in my main program (here written in C++ but could be any programming language)

#include <iostream>

int main(int argn, char* argv[]) {
    // do stuff depending on argv[1], argv[2], etc.

For now I am using mostly random naming conventions like -t for testing, -d for debugging, -l for printing logs e.g. There is no need for adding -, it is just that most shell parameters are named that way. I also use -- for second parameters.

Is there any established naming conventions for main arguments ?

  • 3
    I think this will be a platform dependent answer. For instance windows seems to use a lot of things like /T /D /L where *nix systems are more apt to use -t -T -d -D
    – Rig
    Commented Aug 20, 2012 at 18:05
  • I note you use argn whereas the language definition is argc (for reasons best known to Mssrs K&R)
    – Andrew
    Commented Nov 6, 2012 at 11:57

1 Answer 1


Gnu Standards and GNU long argument names

Microsoft's suggestions


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.