Re: Memory allocation failed. Why?

2016-11-20 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 21 November 2016 at 06:45:04 UTC, ag0aep6g wrote: On 11/21/2016 07:36 AM, Stefan Koch wrote: On Monday, 21 November 2016 at 03:58:00 UTC, MGW wrote: On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote: On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: [...] [...]

Re: Memory allocation failed. Why?

2016-11-20 Thread ag0aep6g via Digitalmars-d-learn
On 11/21/2016 07:36 AM, Stefan Koch wrote: On Monday, 21 November 2016 at 03:58:00 UTC, MGW wrote: On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote: On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: import core.sys.windows.windows: MessageBoxA; void test() { for(int i;

Re: Memory allocation failed. Why?

2016-11-20 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 21 November 2016 at 03:58:00 UTC, MGW wrote: On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote: On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: import core.sys.windows.windows: MessageBoxA; void test() { for(int i; i != 10; i++) { ubyte[]

Re: Memory allocation failed. Why?

2016-11-20 Thread MGW via Digitalmars-d-learn
On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote: On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: import core.sys.windows.windows: MessageBoxA; void test() { for(int i; i != 10; i++) { ubyte[] buf; for(int j; j != 1; j++) buf

Re: Memory allocation failed. Why?

2016-11-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 20 November 2016 at 18:58:04 UTC, Basile B. wrote: On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: [...] For me there's no exception. Maybe the GC is poluted. Try to add this after each iteration in the first test loop: import core.memory: GC;

Re: Making floating point deterministic cross diffrent platforms/hardware

2016-11-20 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 20 November 2016 at 22:36:12 UTC, Chainingsolid wrote: I'm making an rts so the client/server model would require very unrealistic bandwidth, hence the lock step peer to peer system. Indeed, peer to peer require determinism I guess.

Re: Making floating point deterministic cross diffrent platforms/hardware

2016-11-20 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Sunday, 20 November 2016 at 21:42:30 UTC, ketmar wrote: On Sunday, 20 November 2016 at 21:31:09 UTC, Guillaume Piolat wrote: I think you can roughly have that with ldc, always using SSE and the same rounding-mode. ARM. oops. No problem with ARM + x86 for double and float.

Re: Making floating point deterministic cross diffrent platforms/hardware

2016-11-20 Thread Chainingsolid via Digitalmars-d-learn
On Sunday, 20 November 2016 at 21:31:09 UTC, Guillaume Piolat wrote: If you use client prediction, and the server (authoritative) sends the correct player position to clients regularly (action game), then no determinism is actually needed. Ask Manu who knows more about this. I'm making an

Re: Making floating point deterministic cross diffrent platforms/hardware

2016-11-20 Thread ketmar via Digitalmars-d-learn
On Sunday, 20 November 2016 at 21:31:09 UTC, Guillaume Piolat wrote: I think you can roughly have that with ldc, always using SSE and the same rounding-mode. ARM. oops.

Re: Making floating point deterministic cross diffrent platforms/hardware

2016-11-20 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 20 November 2016 at 19:12:06 UTC, Chainingsolid wrote: I planning out a game that has to use a lock step, peer to peer networking model to achieve multiplayer, and thus I need to have any floating point used produce the exact same results, no matter what, aka be completely

Re: shared arrray problem

2016-11-20 Thread ag0aep6g via Digitalmars-d-learn
On 11/20/2016 09:09 PM, Charles Hixson via Digitalmars-d-learn wrote: Thinking it over a bit more, the item returned would need to be a struct, but the struct wouldn't contain the array, it would just contain a reference to the array and a start and end offset. The array would need to live

Re: shared arrray problem

2016-11-20 Thread Charles Hixson via Digitalmars-d-learn
On 11/20/2016 03:42 AM, ag0aep6g via Digitalmars-d-learn wrote: On 11/20/2016 04:34 AM, Charles Hixson via Digitalmars-d-learn wrote: Whether you would call the change "break things for your code" might be dubious. It would be effectively broken, even if technically my code was doing the

Re: How to correct share data between threads?

2016-11-20 Thread Nicolas Gurrola via Digitalmars-d-learn
On Sunday, 20 November 2016 at 17:50:38 UTC, Konstantin Kutsevalov wrote: Ok, thank you. But I cannot to find good example. May be you know some good article about it? The Phobos documentation is a good place to start, as it has examples as well as the documentation for all the APIs:

Re: Making floating point deterministic cross diffrent platforms/hardware

2016-11-20 Thread ketmar via Digitalmars-d-learn
write your own software fp library. this is the only way to cover all your broad cases.

Re: shared arrray problem

2016-11-20 Thread ag0aep6g via Digitalmars-d-learn
On 11/20/2016 08:30 PM, Charles Hixson via Digitalmars-d-learn wrote: Well, that precise approach wouldn't work. (The traits aren't a part of the sturct, e.g.), What do you mean by "traits"?

Re: shared arrray problem

2016-11-20 Thread Charles Hixson via Digitalmars-d-learn
On 11/20/2016 03:42 AM, ag0aep6g via Digitalmars-d-learn wrote: On 11/20/2016 04:34 AM, Charles Hixson via Digitalmars-d-learn wrote: Whether you would call the change "break things for your code" might be dubious. It would be effectively broken, even if technically my code was doing the

Making floating point deterministic cross diffrent platforms/hardware

2016-11-20 Thread Chainingsolid via Digitalmars-d-learn
I planning out a game that has to use a lock step, peer to peer networking model to achieve multiplayer, and thus I need to have any floating point used produce the exact same results, no matter what, aka be completely deterministic. What would I need to do to achieve this?

Re: Memory allocation failed. Why?

2016-11-20 Thread Basile B. via Digitalmars-d-learn
On Sunday, 20 November 2016 at 17:47:50 UTC, MGW wrote: import core.sys.windows.windows: MessageBoxA; void test() { for(int i; i != 10; i++) { ubyte[] buf; for(int j; j != 1; j++) buf ~= 65; MessageBoxA(null, "--on for--".ptr,

Re: How to correct share data between threads?

2016-11-20 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Saturday, 19 November 2016 at 19:04:12 UTC, Nicolas Gurrola wrote: On Saturday, 19 November 2016 at 17:29:30 UTC, Konstantin Kutsevalov wrote: I need to receiving data in main thread and send its to other thread for processing. There is a simple (but wrong) code for example. What need I to

Memory allocation failed. Why?

2016-11-20 Thread MGW via Digitalmars-d-learn
import core.sys.windows.windows: MessageBoxA; void test() { for(int i; i != 10; i++) { ubyte[] buf; for(int j; j != 1; j++) buf ~= 65; MessageBoxA(null, "--on for--".ptr, "".ptr, 0); // delete buf; // if ON - then

Re: Using opApply and Attributes

2016-11-20 Thread ketmar via Digitalmars-d-learn
On Sunday, 20 November 2016 at 16:36:18 UTC, Q. Schroll wrote: How can I have relative-@attrib functions without unnecessary manual overloading? import std.traits; auto f1(DG) (DG dg) if (isCallable!DG && Parameters!DG.length == 1 && is(Parameters!DG[0] == int)) { // check other things here

Using opApply and Attributes

2016-11-20 Thread Q. Schroll via Digitalmars-d-learn
When using functions with delegate (or function ptr) parameters which should comply with some attributes, I cannot call the delegate in the function what makes it pretty useless (I haven't done research, but I claim that generally most functions taking delegate parameters call them). void

Re: Compiling and linking libraries

2016-11-20 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 20 November 2016 at 01:01:16 UTC, Darren wrote: Thank you for this! Great information. So dub dynamically "add" code from the dll into the source code at runtime? No. DUB doesn't have anything to do with runtime and doesn't know anything about the DLLs you use. The Derelict

Re: Complex numbers are harder to use than in C

2016-11-20 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Saturday, 19 November 2016 at 19:42:27 UTC, Marduk wrote: On Saturday, 19 November 2016 at 16:17:08 UTC, Meta wrote: On Saturday, 19 November 2016 at 09:38:38 UTC, Marduk wrote: [...] D used to support complex numbers in the language (actually it still does, they're just deprecated).

Re: How to declare function with the same call signature as another?

2016-11-20 Thread Tofu Ninja via Digitalmars-d-learn
On Sunday, 20 November 2016 at 11:52:01 UTC, Tofu Ninja wrote: ... Also does not include function linkage :/

How to access https web page using std.net.curl?

2016-11-20 Thread acbbad via Digitalmars-d-learn
I had tried std.net.curl.get (). However, the following error occurs -- std.net.curl.CurlException@std\net\curl.d(4097): Peer certificate cannot be authenticated with given CA certificates on handle 2175BB8 -- Guess it seems to be a

Re: Complex numbers are harder to use than in C

2016-11-20 Thread Marc Schütz via Digitalmars-d-learn
On Saturday, 19 November 2016 at 20:24:09 UTC, Marduk wrote: On Saturday, 19 November 2016 at 12:55:57 UTC, Marc Schütz wrote: On Saturday, 19 November 2016 at 11:11:36 UTC, Nordlöw wrote: On Saturday, 19 November 2016 at 09:38:38 UTC, Marduk wrote: The difference is that D is more verbose. Am

Re: How to declare function with the same call signature as another?

2016-11-20 Thread Tofu Ninja via Digitalmars-d-learn
On Sunday, 20 November 2016 at 11:23:37 UTC, Nicholas Wilson wrote: On Sunday, 20 November 2016 at 11:19:24 UTC, Tofu Ninja wrote: I feel like this should be simple but I can't seem to figure it out. How do I declare a function to have the same call signature as another function/callable type?

Re: Complex numbers are harder to use than in C

2016-11-20 Thread Marc Schütz via Digitalmars-d-learn
On Saturday, 19 November 2016 at 20:08:42 UTC, Marduk wrote: On Saturday, 19 November 2016 at 11:11:36 UTC, Nordlöw wrote: On Saturday, 19 November 2016 at 09:38:38 UTC, Marduk wrote: The difference is that D is more verbose. Am I missing something? Can we have C's behaviour in D? Something

Re: what is mean? ( Offset 78887H Record Type 00C3)

2016-11-20 Thread xky via Digitalmars-d-learn
On Saturday, 19 November 2016 at 09:35:33 UTC, Basile B. wrote: Is the message is about double definition ? I knew the cause. You were right. It is my mistake. I'm really sorry.

Re: shared arrray problem

2016-11-20 Thread ag0aep6g via Digitalmars-d-learn
On 11/20/2016 04:34 AM, Charles Hixson via Digitalmars-d-learn wrote: Whether you would call the change "break things for your code" might be dubious. It would be effectively broken, even if technically my code was doing the correct thing. But my code wouldn't be storing the data that needed

Re: How to declare function with the same call signature as another?

2016-11-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 20 November 2016 at 11:19:24 UTC, Tofu Ninja wrote: I feel like this should be simple but I can't seem to figure it out. How do I declare a function to have the same call signature as another function/callable type? Like if I have: alias Sig = int function(int x, int y); How do I

Re: How to declare function with the same call signature as another?

2016-11-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 20 November 2016 at 11:19:24 UTC, Tofu Ninja wrote: I feel like this should be simple but I can't seem to figure it out. How do I declare a function to have the same call signature as another function/callable type? Like if I have: alias Sig = int function(int x, int y); How do I

How to declare function with the same call signature as another?

2016-11-20 Thread Tofu Ninja via Digitalmars-d-learn
I feel like this should be simple but I can't seem to figure it out. How do I declare a function to have the same call signature as another function/callable type? Like if I have: alias Sig = int function(int x, int y); How do I define a function such that it will have the same call

Re: Popular embedded language for scripting in D

2016-11-20 Thread Soulsbane via Digitalmars-d-learn
On Saturday, 19 November 2016 at 22:18:39 UTC, Sai wrote: I have seen luad and Walters own JavaScript VM that can be used in D for embedded scripting purpose in an application. I was wondering which is more popular among D applications? Any suggestions? Thanks, sai I've used LuaD in a