digitalmars.D.learn - ldc std.getopt
- Laeeth Isharc (93/93) Apr 29 2015 When building the following (reduced by hand - I hope I didn't
- Anon (4/8) Apr 29 2015 The help generating feature of std.getopt is new in 2.067. Use
- Laeeth Isharc (2/12) Apr 29 2015 Thanks! Laeeth.
When building the following (reduced by hand - I hope I didn't
take out something useful when doing so):
import std.stdio;
import std.getopt;
int main(string[] args)
{
string apiKey;
string startCode;
bool reverseOrder=false;
bool noReverse=false;
auto helpInformation = getopt(
args,
"apikey|k", "specify API key directly",&apiKey,
"startcode|c", "start begining from specified code",&startCode,
"reverse|r","reverse sort order",&reverseOrder,
"noreverse|n","don't reverse sort order",&noReverse
);
if (helpInformation.helpWanted)
{
defaultGetoptPrinter( "downloader tool",
helpInformation.options);
return(1);
}
}
I get the following errors under LDC (this is LDC beta, but same
problem under master) although the code compiles fine under DMD.
Am I doing something wrong?
Laeeth.
Building app ~master configuration "application", build type
release.
Running ldmd...
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(547):
Deprecation: using * on an array is deprecated; use
*(receiver).ptr instead
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(547):
Error: cannot modify immutable expression
*cast(immutable(char)*)receiver
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(548):
Deprecation: using * on an array is deprecated; use
*(receiver).ptr instead
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(548):
Deprecation: using * on an array is deprecated; use
*(receiver).ptr instead
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(548):
Error: cannot modify immutable expression
*cast(immutable(char)*)receiver
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(441):
Error: template instance std.getopt.handleOption!string error
instantiating
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(392):
instantiated from here: getoptImpl!(string, string, bool*,
string, string, string*, string, string, string*, string, string,
bool*, string, string, bool*)
source/quandljuice.d(74): instantiated from here:
getopt!(string, string, bool*, string, string, string*, string,
string, string*, string, string, bool*, string, string, bool*)
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(433):
Error: array index [1] is outside array bounds [0 .. 1]
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(442):
Error: string slice [2 .. 1] is out of bounds
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(442):
Error: cannot return non-void from void function
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(442):
Error: template instance std.getopt.getoptImpl!(bool*) error
instantiating
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(392):
8 recursive instantiations from here: getoptImpl!(string,
string, bool*, string, string, string*, string, string, string*,
string, string, bool*, string, string, bool*)
source/quandljuice.d(74): instantiated from here:
getopt!(string, string, bool*, string, string, string*, string,
string, string*, string, string, bool*, string, string, bool*)
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(442):
Error: cannot return non-void from void function
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(442):
Error: cannot return non-void from void function
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(442):
Error: cannot return non-void from void function
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(442):
Error: cannot return non-void from void function
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(442):
Error: cannot return non-void from void function
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(442):
Error: cannot return non-void from void function
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(442):
Error: cannot return non-void from void function
/opt/ldc2-0.15.2-beta1-linux-x86_64/bin/../import/std/getopt.d(392):
Error: cannot return non-void from void function
source/quandljuice.d(84): Error: undefined identifier
defaultGetoptPrinter
FAIL
.dub/build/application-release-linux.posix-x86_64-ldc_2066-2DF1454C29130
0C55C59AAC96C6108A/
quandljuice executable
Apr 29 2015
On Wednesday, 29 April 2015 at 19:43:44 UTC, Laeeth Isharc wrote:I get the following errors under LDC (this is LDC beta, but same problem under master) although the code compiles fine under DMD. Am I doing something wrong?The help generating feature of std.getopt is new in 2.067. Use branch "merge-2.067" for that. Otherwise, don't use std.getopt's help generation just yet.
Apr 29 2015
On Wednesday, 29 April 2015 at 20:45:26 UTC, Anon wrote:On Wednesday, 29 April 2015 at 19:43:44 UTC, Laeeth Isharc wrote:Thanks! Laeeth.I get the following errors under LDC (this is LDC beta, but same problem under master) although the code compiles fine under DMD. Am I doing something wrong?The help generating feature of std.getopt is new in 2.067. Use branch "merge-2.067" for that. Otherwise, don't use std.getopt's help generation just yet.
Apr 29 2015








"Laeeth Isharc" <nospamlaeeth nospam.laeeth.com>