Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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 ?

share|improve this question
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 Aug 20 '12 at 18:05
    
I note you use argn whereas the language definition is argc (for reasons best known to Mssrs K&R) –  Andrew Nov 6 '12 at 11:57

1 Answer 1

up vote 2 down vote accepted

Gnu Standards and GNU long argument names

Microsoft's suggestions

share|improve this answer
    
Awesome. Thanks. –  vanna Aug 20 '12 at 20:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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