Re: -O flag ; automatic cast in a bitshift

2018-09-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Thursday, 20 September 2018 at 11:14:05 UTC, Guillaume Lathoud wrote: Thanks! FYI, it's undefined in D mainly because the behavior of the actual Intel CPU instruction is undefined in such cases: https://c9x.me/x86/html/file_module_x86_id_285.html "it is undefined for SHL and SHR

Re: Entry point errors when using LDC to compile Windows Subsystem module with -m32

2018-09-20 Thread kinke via Digitalmars-d-learn
On Thursday, 20 September 2018 at 20:48:50 UTC, spikespaz wrote: I downloaded a known-good 32-bit libcurl.dll to distribute with the project I just figured that the multilib package is indeed missing a 32-bit libcurl.dll. It can be found in the bin dir of the win32 package (which btw is the

Re: Entry point errors when using LDC to compile Windows Subsystem module with -m32

2018-09-20 Thread kinke via Digitalmars-d-learn
On Thursday, 20 September 2018 at 20:48:50 UTC, spikespaz wrote: When comping with the command below, I get linker errors saying that '/SUBSYSTEM:WINDOWS" isn't recognized and is ignored Then you're most likely accidentally using DMD's link.exe. When using a multilib LDC build on Win64 and

Destructor and postblit with scope qualifier

2018-09-20 Thread Per Nordlöw via Digitalmars-d-learn
What effect does the scope qualifier have on a destructor such as https://github.com/atilaneves/automem/blob/master/source/automem/vector.d#L92 and a postblit such as https://github.com/atilaneves/automem/blob/master/source/automem/vector.d#L86 ?

Entry point errors when using LDC to compile Windows Subsystem module with -m32

2018-09-20 Thread spikespaz via Digitalmars-d-learn
I have a user having issues running my project on their 32-bit Windows install. I thought LDC2 compiled as 32-bit by default, but for some reason the errors persist for him regardless. In attempt to resolve this, I am doing everything that requires 32-bit explicitly. I downloaded a known-good

Re: BetterC + Windows + setjmp longjmp

2018-09-20 Thread Diederik de Groot via Digitalmars-d-learn
On Thursday, 20 September 2018 at 12:11:55 UTC, SrMordred wrote: Ok, after a better look at the sources I finally got it: setjmp is a macro. the true function signature is "int _setjmp(jmp_buf, void*)" the void* is the current function address which in mingw sources are capture by

Re: std.process.execute without capturing stderr?

2018-09-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/20/18 4:02 AM, berni wrote: On Thursday, 20 September 2018 at 07:36:06 UTC, Paul Backus wrote: Looks like `Config.stderrPassThrough` [1] should do what you want:     const result = execute(args[1..$], null, Config.stdErrPassThrough); [1]

Re: How to use math functions in dcompute?

2018-09-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 20 September 2018 at 12:43:02 UTC, Nicholas Wilson wrote: Hmm, I can reproduce. Will look into it. pragma(LDC_intrinsic, "llvm.nvvm.cos.approx.f") float cos(float val); does work but is an approximation.

Re: How to use math functions in dcompute?

2018-09-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 20 September 2018 at 05:16:04 UTC, Sobaya wrote: On Wednesday, 19 September 2018 at 00:22:44 UTC, Nicholas Wilson wrote: On Wednesday, 19 September 2018 at 00:11:13 UTC, Nicholas Wilson wrote: On Tuesday, 18 September 2018 at 06:25:33 UTC, Sobaya wrote: On Tuesday, 18 September

Re: BetterC + Windows + setjmp longjmp

2018-09-20 Thread SrMordred via Digitalmars-d-learn
Ok, after a better look at the sources I finally got it: setjmp is a macro. the true function signature is "int _setjmp(jmp_buf, void*)" the void* is the current function address which in mingw sources are capture by "__builtin_frame_address(0)". And I did´t look yet to see if Dlang have an

Re: -O flag ; automatic cast in a bitshift

2018-09-20 Thread Guillaume Lathoud via Digitalmars-d-learn
On Thursday, 20 September 2018 at 11:08:32 UTC, ketmar wrote: Guillaume Lathoud wrote: this is UB. by the specs, values are promoted to int, and shifting int by 50 is UB. so both results are nonsense. Thanks!

Re: -O flag ; automatic cast in a bitshift

2018-09-20 Thread ketmar via Digitalmars-d-learn
Guillaume Lathoud wrote: this is UB. by the specs, values are promoted to int, and shifting int by 50 is UB. so both results are nonsense.

-O flag ; automatic cast in a bitshift

2018-09-20 Thread Guillaume Lathoud via Digitalmars-d-learn
Hello, the code below behaves differently when compiled with or without the -O flag (both DMD and LDC2). Two questions: (1) does the D language explicitly specifies what the following expression should do? If yes, where? ' |= << ' In the example below, there seems to be a cast to 32

SerialPort

2018-09-20 Thread braboar via Digitalmars-d-learn
I am going to play with serial port read/write, so I fetched serial-port. After that, I wrote simple program: auto port_name = "/dev/ttyUSB1"; auto reader = new SerialPort(port_name); reader.dataBits(DataBits.data8); reader.stopBits(StopBits.one); reader.parity(Parity.none);

Re: std.process.execute without capturing stderr?

2018-09-20 Thread berni via Digitalmars-d-learn
On Thursday, 20 September 2018 at 07:36:06 UTC, Paul Backus wrote: Looks like `Config.stderrPassThrough` [1] should do what you want: const result = execute(args[1..$], null, Config.stdErrPassThrough); [1] https://dlang.org/phobos/std_process.html#.Config.stderrPassThrough In theory

Re: std.process.execute without capturing stderr?

2018-09-20 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 20 September 2018 at 07:24:52 UTC, berni wrote: I need to execute a program and capture stdout, which I hoped std.process.execute would do. But unfortunatly this command also captures stderr, which I need to be ignored. When looking at the implementation of std.process.execute I

std.process.execute without capturing stderr?

2018-09-20 Thread berni via Digitalmars-d-learn
I need to execute a program and capture stdout, which I hoped std.process.execute would do. But unfortunatly this command also captures stderr, which I need to be ignored. When looking at the implementation of std.process.execute I see, that I can probably do this by removing