Either the documentation is incorrect or the implementation is. The documentation says: "If the option has a parameter, that must be "stuck" to the option without any intervening space or "=": " and "Forms such as -t 5 and -timeout=5 will be not accepted. " Does not appear to be true. The form -t 5 is accepted. Example: import std.stdio; import std.getopt; void main(string[] args) { uint age; std.getopt.getopt(args, "a", &age); writeln("age = ", age); writeln("args = ", args); } C:\temp>dmd getopt.d && getopt -a 5000 age = 5000 args = ["getopt"] Windows XP 32 bit. v2.065 The implementation seems to work correctly as I regard it, unless there is a reason why it should be disallowed I think short options need not have thier parameter immediatly follow the option, and so the documentation should be adjusted.
@quickfur created dlang/phobos pull request #7555 "Fix bug 12521: update docs to match current getopt behaviour." fixing this issue: - Fix bug 12521: update docs to match current getopt behaviour. https://github.com/dlang/phobos/pull/7555
dlang/phobos pull request #7555 "Fix bug 12521: update docs to match current getopt behaviour." was merged into master: - 8812bb54497ecde6d5e2535991508d7152157f49 by H. S. Teoh: Fix bug 12521: update docs to match current getopt behaviour. https://github.com/dlang/phobos/pull/7555