Tagging of arguments ref/out, or just out

Kagamin spam at here.lot
Mon Aug 8 11:30:10 PDT 2011


Michel Fortin Wrote:

> I recently had to use getopt. You use it like that:
> 
> 	bool option;
> 	int counter;
> 
> 	getopt(args,
> 		"option|o", &option,
> 		"counter|c", &counter);
> 
> The problem is that taking addresses of a stack variable is disabled in 
> SafeD, which means getopt doesn't work in SafeD, which puts SafeD in a 
> strange position.

const opts = getopt(args);
const option = opts.get!bool("option|o");
const counter = opts.get!int("counter|c"); // also reusable


More information about the Digitalmars-d mailing list