Invalid string literal in ASM

2018-10-01 Thread dokutoku via Digitalmars-d-learn
I get a compiler error when I try to put non-ASCII characters in a string literal in the inline assembler. Is this part of the specifications?

Re: Performance of GC.collect() for single block of `byte`s

2018-10-01 Thread Rainer Schuetze via Digitalmars-d-learn
On 28/09/2018 14:21, Per Nordlöw wrote: On Monday, 24 September 2018 at 14:31:45 UTC, Steven Schveighoffer wrote: It's not scanning the blocks. But it is scanning the stack. Each time you are increasing the space it must search for a given *target*. It also must *collect* any previous

Re: Invalid string literal in ASM

2018-10-01 Thread Basile B. via Digitalmars-d-learn
On Monday, 1 October 2018 at 08:14:07 UTC, dokutoku wrote: I get a compiler error when I try to put non-ASCII characters in a string literal in the inline assembler. Is this part of the specifications? It's not clear, see https://dlang.org/spec/iasm.html#raw_data: "if an operand is a string

Re: Linking with a non-default druntime

2018-10-01 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 30 September 2018 at 19:53:02 UTC, Basile B. wrote: this way you can very easily change-compile-test, without recompiling the whole runtime and phobos each time. Ok, thanks. Is it possible to register an extra GC in a separate program by overriding the logic in `gc.proxy` in

Re: Linking with a non-default druntime

2018-10-01 Thread Basile B. via Digitalmars-d-learn
On Monday, 1 October 2018 at 07:17:59 UTC, Per Nordlöw wrote: On Sunday, 30 September 2018 at 19:53:02 UTC, Basile B. wrote: this way you can very easily change-compile-test, without recompiling the whole runtime and phobos each time. Ok, thanks. Is it possible to register an extra GC in a

Re: Prevent opening binary/other garbage files

2018-10-01 Thread helxi via Digitalmars-d-learn
On Sunday, 30 September 2018 at 03:19:11 UTC, Adam D. Ruppe wrote: On Saturday, 29 September 2018 at 23:46:26 UTC, helxi wrote: Thanks. Would you say https://dlang.org/library/std/encoding/get_bom.html is useful in this context? Eh, not really, most text files will not have one. Hi, I

Re: How to implement D to HTML pages ?

2018-10-01 Thread rjframe via Digitalmars-d-learn
On Mon, 01 Oct 2018 19:29:56 +, Aurélien Plazzotta wrote: On Mon, 01 Oct 2018 19:29:56 +, Aurélien Plazzotta wrote: > Hello guys, > > I would like to implement a forum and a blog within my website > (currently including only HTML, CSS and JS, written without CMS), using > D and SQL but I

Re: Use nested functions as callbacks with Windows API functions?

2018-10-01 Thread spikespaz via Digitalmars-d-learn
On Monday, 1 October 2018 at 21:03:24 UTC, Boris-Barboris wrote: On Monday, 1 October 2018 at 20:27:43 UTC, spikespaz wrote: I was hoping I could use something more akin to JavaScript's syntax: (void* hWnd, long) => {}. I tried this but I'm getting errors with the signature, it says the

Re: Use nested functions as callbacks with Windows API functions?

2018-10-01 Thread spikespaz via Digitalmars-d-learn
On Monday, 1 October 2018 at 21:03:24 UTC, Boris-Barboris wrote: On Monday, 1 October 2018 at 20:27:43 UTC, spikespaz wrote: I was hoping I could use something more akin to JavaScript's syntax: (void* hWnd, long) => {}. I tried this but I'm getting errors with the signature, it says the

Wrong module initialization order when building with Dub on Windows?

2018-10-01 Thread Vladimir Panteleev via Digitalmars-d-learn
Ran into this today, don't have time to dig in now but maybe someone ran into this too. Steps to reproduce: - git clone https://github.com/CyberShadow/ae - cd ae/demo/inputtiming - (download/unpack https://www.libsdl.org/release/SDL2-2.0.8-win32-x86.zip or

Re: Invalid string literal in ASM

2018-10-01 Thread Basile B. via Digitalmars-d-learn
On Monday, 1 October 2018 at 09:24:47 UTC, Basile B. wrote: On Monday, 1 October 2018 at 08:14:07 UTC, dokutoku wrote: I get a compiler error when I try to put non-ASCII characters in a string literal in the inline assembler. Is this part of the specifications? It's not clear, see

Re: Linking with a non-default druntime

2018-10-01 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 1 October 2018 at 08:27:54 UTC, Basile B. wrote: I think so. Apparently it's registered with a string, e.g "manual" and you pass a special druntime option with your program to select. Actually i would be interested to make the interface with assignable handlers since you don't seem

Re: -O flag ; automatic cast in a bitshift

2018-10-01 Thread Guillaume Lathoud via Digitalmars-d-learn
On Friday, 21 September 2018 at 01:44:33 UTC, Vladimir Panteleev wrote: On Thursday, 20 September 2018 at 11:14:05 UTC, Guillaume FYI, it's undefined in D mainly because the behavior of the actual Intel CPU instruction is undefined in such cases:

Dlang tour - Unittesting example

2018-10-01 Thread Joe via Digitalmars-d-learn
There appears to be a problem with the example at https://tour.dlang.org/tour/en/gems/unittesting If compiled with -unittest, the resulting program crashes. It happens with ldc2 on Linux but it can also be seen if you click on "Export" and run it with dmd -unittest.

Re: Wrong module initialization order when building with Dub on Windows?

2018-10-01 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 2 October 2018 at 01:57:00 UTC, Vladimir Panteleev wrote: Ran into this today, don't have time to dig in now but maybe someone ran into this too. Steps to reproduce: - git clone https://github.com/CyberShadow/ae - cd ae/demo/inputtiming - (download/unpack

Use std.traits.getSymbolsByUDA to access members of instance.

2018-10-01 Thread Jonathan via Digitalmars-d-learn
I can use `std.traits.getSymbolsByUDA` to get all the members of a class that have a particular UDA `getSymbolsByUDA(ValueType, UDA)`. But how do I get the values with it? Is there a more convenient way than `__traits(getMember, value, getSymbolsByUDA(ValueType, UDA)[0].stringof)`?

Re: contracts in interfaces: do they work, do I have to do something to enable checking of contracts ?

2018-10-01 Thread Alex via Digitalmars-d-learn
On Monday, 1 October 2018 at 13:49:53 UTC, Emil wrote: I am trying my hand at contracts and they work fine in plain functions and in methods, but I can't make them work in interfaces. https://dlang.org/spec/interface.html#interface-contracts $ dmd --version DMD64 D Compiler v2.081.1

contracts in interfaces: do they work, do I have to do something to enable checking of contracts ?

2018-10-01 Thread Emil via Digitalmars-d-learn
I am trying my hand at contracts and they work fine in plain functions and in methods, but I can't make them work in interfaces. https://dlang.org/spec/interface.html#interface-contracts $ dmd --version DMD64 D Compiler v2.081.1 Copyright (C) 1999-2018 by The D Language Foundation, All Rights

Re: Performance of GC.collect() for single block of `byte`s

2018-10-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/1/18 3:21 AM, Rainer Schuetze wrote: On 28/09/2018 14:21, Per Nordlöw wrote: On Monday, 24 September 2018 at 14:31:45 UTC, Steven Schveighoffer wrote: It's not scanning the blocks. But it is scanning the stack. Each time you are increasing the space it must search for a given

Use nested functions as callbacks with Windows API functions?

2018-10-01 Thread spikespaz via Digitalmars-d-learn
I have the following code, this works. import core.sys.windows.windows: EnumWindows; import std.stdio: writeln; void*[] hWndList; extern (Windows) int callback(void* hWnd, long /* lParams */ ) nothrow { hWndList ~= hWnd;

Re: Use nested functions as callbacks with Windows API functions?

2018-10-01 Thread Boris-Barboris via Digitalmars-d-learn
On Monday, 1 October 2018 at 20:27:43 UTC, spikespaz wrote: I was hoping I could use something more akin to JavaScript's syntax: (void* hWnd, long) => {}. I tried this but I'm getting errors with the signature, it says the function is a delegate and apparently Windows API can't accept a

How to implement D to HTML pages ?

2018-10-01 Thread Aurélien Plazzotta via Digitalmars-d-learn
Hello guys, I would like to implement a forum and a blog within my website (currently including only HTML, CSS and JS, written without CMS), using D and SQL but I really don't know how to proceed. How can I integrate D into HTML pages? Are there any kind of include's commands like PHP ?

Re: Prevent opening binary/other garbage files

2018-10-01 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 1 October 2018 at 15:21:24 UTC, helxi wrote: I tried out https://dlang.org/library/std/utf/validate.html before manually checking for encoding myself so I ended up with the code below. I was fairly surprised that "*.o" (object) files are UTF encoded! Is it normal? Yes. Any random