crash on args.getopt
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 24 14:48:45 PST 2015
On 01/24/2015 11:39 AM, Suliman wrote:
> First of all it's seems bug in docs:
> void main(string[] args)
> {
> getopt(
> args,
> "length", &length, // numeric
> "file", &data, // string
> "verbose", &verbose, // flag
> "color", &color); // enum
> ...
> }
>
> with args inside getopt I am getting:
> C:\D\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(547): Deprecation:
> using * o
> n an array is deprecated; use *(receiver).ptr instead
What version is your compiler? The example compiles as is with git head
dmd (after removing the ellipsis):
import std.getopt;
string data = "file.dat";
int length = 24;
bool verbose;
enum Color { no, yes };
Color color;
void main(string[] args)
{
getopt(
args,
"length", &length, // numeric
"file", &data, // string
"verbose", &verbose, // flag
"color", &color); // enum
}
Ali
More information about the Digitalmars-d-learn
mailing list