Re: getopt defaultGetoptPrinter is not safe. Is there a reason for that?

2018-08-17 Thread Markus via Digitalmars-d-learn
On Friday, 17 August 2018 at 08:09:52 UTC, Markus wrote: I wonder what's the reason for that? I wonder why it's not at least @trusted. Literally, can't I trust that method/function?

Re: getopt defaultGetoptPrinter is not safe. Is there a reason for that?

2018-08-17 Thread rikki cattermole via Digitalmars-d-learn
On 17/08/2018 8:32 PM, Markus wrote: On Friday, 17 August 2018 at 08:09:52 UTC, Markus wrote: I wonder what's the reason for that? I wonder why it's not at least @trusted. Literally, can't I trust that method/function? It honestly looks like a simple case of nobody has yet bothered to do

Set optional function parameter

2018-08-17 Thread Andrey via Digitalmars-d-learn
Hello, In D there is a nice function: auto Tuple!(int,"status",string,"output") executeShell ( scope const(char)[] command, const(string[string]) env = cast(const(string[string]))null, Config config = cast(Config)0, ulong maxOutput = 18446744073709551615LU, scope const(char)[] workDir =

getopt defaultGetoptPrinter is not safe. Is there a reason for that?

2018-08-17 Thread Markus via Digitalmars-d-learn
Hi. I'm a big fan of @safe code. But within my first 20 program lines I already run into problems: Error: @safe function D main cannot call @system function std.getopt.defaultGetoptPrinter https://dlang.org/phobos/std_getopt.html#.defaultGetoptPrinter I wonder what's the reason for that?

Re: Phobos docs in pdf?

2018-08-17 Thread SeanC4S via Digitalmars-d-learn
I used CUPS to print as pdf individual pages from the standard library. I want to get all the basic information I need easily at hand. I used unpredictableSeed in my code. It seems to be a property of something somewhere. I hope it is thread safe. Who knows? I guess I'll look at the source

Re: Phobos docs in pdf?

2018-08-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 17, 2018 5:19:11 AM MDT SeanC4S via Digitalmars-d-learn wrote: > I used CUPS to print as pdf individual pages from the standard > library. I want to get all the basic information I need easily at > hand. > I used unpredictableSeed in my code. It seems to be a property > of

Re: ?? How to subscribe to Multicast Broadcasts ??

2018-08-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/12/18 9:12 PM, Joe wrote: Hello All! I've been trying every possible combination and cannot get anything working. (>_<) This is I think the closest I've got, I think the problem may be with the 3 argument.  I'm not sure how to join the Multicast IP membership? (this code currently

Re: Phobos docs in pdf?

2018-08-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/17/18 12:36 AM, SeanC4s wrote: I never program with a computer connected on-line. I need the standard library docs in some off-line format. The downloaded tarball comes with the full html documentation. Just open it from the file. That's what I've done (I generally am online to program,

Re: Array!bool -> Chunks -> foreach: out of bounds

2018-08-17 Thread 0xEAB via Digitalmars-d-learn
On Wednesday, 15 August 2018 at 18:27:56 UTC, Steven Schveighoffer wrote: PR: https://github.com/dlang/phobos/pull/ -Steve Thank you for looking into this one. Regards, Elias

Re: Possible bug in associative array implementation (and/or @safe checking)

2018-08-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/16/18 4:45 PM, Aaron D. Trout wrote: On Thursday, 16 August 2018 at 18:56:45 UTC, Steven Schveighoffer wrote: On 8/16/18 2:32 PM, Aaron D. Trout wrote: [...] On Thursday, 16 August 2018 at 17:20:23 UTC, Steven Schveighoffer wrote: Yes, this is the effect I would expect. D has

Re: How to declare static compile-time assoc array inside struct?

2018-08-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/13/18 9:21 AM, Andrey wrote: On Monday, 13 August 2018 at 11:53:06 UTC, rikki cattermole wrote: You must use a module constructor to initialize it. Tried this: static this() `shared static this()` normal static this runs on every thread creation, and so cannot modify immutable data.

Calling convention for ASM on Linux AMD64

2018-08-17 Thread Sean O'Connor via Digitalmars-d-learn
What calling convention is used for assembly language in Linux AMD64? Normally the parameters go in fixed order into designated registers. import std.stdio; // Linux AMD64 float* test(float *x,ulong y){ asm{ naked; align 16; mov RAX,RDI;

Re: Set optional function parameter

2018-08-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 17, 2018 2:52:53 AM MDT Andrey via Digitalmars-d-learn wrote: > Hello, > > In D there is a nice function: > > auto Tuple!(int,"status",string,"output") executeShell ( > > > > scope const(char)[] command, > > const(string[string]) env = cast(const(string[string]))null, > >

Re: Load D shared library on windows x64

2018-08-17 Thread Tofu Ninja via Digitalmars-d-learn
On Friday, 17 August 2018 at 20:27:05 UTC, Tofu Ninja wrote: Its this part that fails... always returns null HMODULE h = cast(HMODULE) Runtime.loadLibrary(dllName); if (h is null) { writeln("error loading"); return; } I there any way to see why Runtime.loadLibrary is failing?

Re: How to declare static compile-time assoc array inside struct?

2018-08-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 17, 2018 9:59:18 AM MDT Steven Schveighoffer via Digitalmars-d-learn wrote: > On 8/13/18 9:21 AM, Andrey wrote: > > On Monday, 13 August 2018 at 11:53:06 UTC, rikki cattermole wrote: > >> You must use a module constructor to initialize it. > > > > Tried this: > > static this() >

Load D shared library on windows x64

2018-08-17 Thread Tofu Ninja via Digitalmars-d-learn
Do shared libraries work? I am trying to load a D library into a D program but Runtime.loadLibrary just returns null for me and I am not sure what I am doing wrong. import std.stdio; import std.file : exists, getcwd, rename; import core.thread; import std.conv : to; version(tofu_dynamic){

Re: Load D shared library on windows x64

2018-08-17 Thread Tofu Ninja via Digitalmars-d-learn
Its this part that fails... always returns null HMODULE h = cast(HMODULE) Runtime.loadLibrary(dllName); if (h is null) { writeln("error loading"); return; }