Re: Best error msg ever

2017-02-10 Thread Chris Wright via Digitalmars-d
On Fri, 10 Feb 2017 21:19:37 -0800, Walter Bright wrote: > On 2/10/2017 5:14 PM, Chris Wright wrote: >> And @safe doesn't stop you from using uninitialized variables. > > As shown, it does. Default-initialized variables, sorry. I don't see what's less safe about cast(MyInterface)new Object

Re: Best error msg ever

2017-02-10 Thread Walter Bright via Digitalmars-d
On 2/10/2017 5:14 PM, Chris Wright wrote: On Fri, 10 Feb 2017 12:32:19 -0800, Walter Bright wrote: On 2/10/2017 4:41 AM, Nemanja Boric wrote: I saw it happen with D as well: everything compiles, everything is fine, and suddenly segfault. The issue was caused by template argument, two modules

Re: DerelictFmodStudio not found...

2017-02-10 Thread rikki cattermole via Digitalmars-d-learn
On 11/02/2017 5:38 PM, WhatMeWorry wrote: On Saturday, 11 February 2017 at 03:10:35 UTC, WhatMeWorry wrote: I followed the instructions for derelict.fmod. // Load the Fmod library. DerelictFmod.load(); // compiles fine. // Load the Fmod studio library. DerelictFmodStudio.load(); but

Re: Mallocator and 'shared'

2017-02-10 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 10 February 2017 at 23:57:18 UTC, bitwise wrote: https://github.com/dlang/phobos/blob/cd7846eb96ea7d2fa65ccb04b4ca5d5b0d1d4a63/std/experimental/allocator/mallocator.d#L63-L65 Looking at Mallocator, the use of 'shared' doesn't seem correct to me. [...] IIRC you're supposed to use

Re: DerelictFmodStudio not found...

2017-02-10 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 11 February 2017 at 03:10:35 UTC, WhatMeWorry wrote: I followed the instructions for derelict.fmod. // Load the Fmod library. DerelictFmod.load(); // compiles fine. // Load the Fmod studio library. DerelictFmodStudio.load(); but the Studio load

Re: Mallocator and 'shared'

2017-02-10 Thread Michael Coulombe via Digitalmars-d-learn
On Friday, 10 February 2017 at 23:57:18 UTC, bitwise wrote: https://github.com/dlang/phobos/blob/cd7846eb96ea7d2fa65ccb04b4ca5d5b0d1d4a63/std/experimental/allocator/mallocator.d#L63-L65 Looking at Mallocator, the use of 'shared' doesn't seem correct to me. The logic stated in the comment

Re: Questionnaire

2017-02-10 Thread bachmeier via Digitalmars-d-announce
On Friday, 10 February 2017 at 23:02:38 UTC, Dmitry Olshansky wrote: Go - they value simplicity and robust run-time (Go's GC breaks news with sub-milisecond pauses on large heaps). The sheer complexity of D is enough for it to be a hard sell, D's GC is coup de grace. I have never understood

Re: Game Website Server Side

2017-02-10 Thread Ilya Yaroshenko via Digitalmars-d-announce
On Thursday, 9 February 2017 at 16:35:14 UTC, Orkhan wrote: Hello All! We have a multiplayer game website which uses D programming language for server side instant interactions. I need someone professional who is able to make some changes on request. We are the company and we will allocate

Gc collects trigger access violation exception

2017-02-10 Thread mashomee via Digitalmars-d-learn
Hi, everyone. I have a thread running in Dll. But it always halts because of access violation exception when GC begins collecting. This is the thread stack frame in vs2013. testSendSms.exe!_D4core6thread6Thread9isRunningMFNbNdZb() + 0x1 bytes D

DerelictFmodStudio not found...

2017-02-10 Thread WhatMeWorry via Digitalmars-d-learn
I followed the instructions for derelict.fmod. // Load the Fmod library. DerelictFmod.load(); // compiles fine. // Load the Fmod studio library. DerelictFmodStudio.load(); but the Studio load ..\common\derelict_libraries.d(122,5): Error: undefined identifier 'DerelictFmodStudio' In

Re: Best error msg ever

2017-02-10 Thread Jack Stouffer via Digitalmars-d
On Saturday, 11 February 2017 at 01:14:03 UTC, Chris Wright wrote: And @safe doesn't stop you from using uninitialized variables. Yes it does, for pointers anyway void main() @safe { int[] a = void; } /d296/f663.d(3): Error: variable f663.main.a void initializers for pointers not

Re: GSoC 2017 Application Rejected

2017-02-10 Thread Jeremy DeHaan via Digitalmars-d-announce
On Friday, 10 February 2017 at 19:00:54 UTC, CRAIG DILLABAUGH wrote: Hello D Community Just coming here to inform everyone that our D application for GSoC 2017 was sadly rejected. Unfortunately (for me) it is completely my fault, I failed to fill out one line on one of the three forms that

Re: Best error msg ever

2017-02-10 Thread Chris Wright via Digitalmars-d
On Fri, 10 Feb 2017 12:32:19 -0800, Walter Bright wrote: > On 2/10/2017 4:41 AM, Nemanja Boric wrote: >> I saw it happen with D as well: everything compiles, everything is >> fine, and suddenly segfault. The issue was caused by template argument, >> two modules with the same name, but from

[Issue 16724] RandomCover.popFront is a no-op for the first call

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16724 Joseph Rushton Wakeling changed: What|Removed |Added CC|

[Issue 17174] can take address of member of struct parameter in @safe code

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17174 --- Comment #2 from Alex --- @ag0aep6g Ok... my complaint was about your first two lines. Didn't take this into account. But even then, it seems strange to me to be able to take a pointer to a value parameter, in any case...

Re: Why do static arrays affect executable size?

2017-02-10 Thread sarn via Digitalmars-d-learn
On Friday, 10 February 2017 at 15:12:28 UTC, Jonathan M Davis wrote: Module-level and static variables all get put in the executable. So, declaring a static array like that is going to take up space. A dynamic array would do the same thing if you gave it a value of that size. The same thing

Re: two points

2017-02-10 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
On Thursday, 9 February 2017 at 23:44:31 UTC, Walter Bright wrote: I appreciate how frustrating it must be to have people saying, 'Hey, do this! Do that!' without necessarily volunteering their own efforts in support, but organizational improvements so very often fail unless they are eagerly

[Issue 16442] FrontTransversal fails with empty ranges

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16442 --- Comment #1 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/41c2d14658817419cb335a42656130b7aa2959f6 Fix Issue 16442 - FrontTransversal fails with empty

Mallocator and 'shared'

2017-02-10 Thread bitwise via Digitalmars-d-learn
https://github.com/dlang/phobos/blob/cd7846eb96ea7d2fa65ccb04b4ca5d5b0d1d4a63/std/experimental/allocator/mallocator.d#L63-L65 Looking at Mallocator, the use of 'shared' doesn't seem correct to me. The logic stated in the comment above is that 'malloc' is thread safe, and therefore all

[Issue 17154] std.conv.toChars doesn't support $ in slicing

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17154 github-bugzi...@puremagic.com changed: What|Removed |Added Status|REOPENED|RESOLVED

[Issue 17154] std.conv.toChars doesn't support $ in slicing

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17154 --- Comment #3 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/d5ae07f0f125bdefe92b4035dfb35f613dbf9a8a Fix Issue 17154 - Added opDollar to std.conv.toChars

Re: code.dlang.org internal server error

2017-02-10 Thread Soulsbane via Digitalmars-d
On Wednesday, 8 February 2017 at 13:40:56 UTC, Eugene Wissner wrote: On Wednesday, 8 February 2017 at 12:54:00 UTC, John Colvin wrote: On Wednesday, 8 February 2017 at 05:49:55 UTC, Ali Çehreli wrote: code.dlang.org gives the following error: 500 - Internal Server Error Internal Server Error

Re: Questionnaire

2017-02-10 Thread Dmitry Olshansky via Digitalmars-d-announce
On 2/8/17 7:27 PM, Ilya Yaroshenko wrote: 1. Why your company uses D? a. D is the best b. We like D c. I like D and my company allowed me to use D d. My head like D e. Because marketing reasons f. Because my company can be more efficient with D for some tasks then with any other

Re: GSoC 2017 Application Rejected

2017-02-10 Thread CRAIG DILLABAUGH via Digitalmars-d-announce
On Friday, 10 February 2017 at 19:37:20 UTC, bachmeier wrote: On Friday, 10 February 2017 at 19:00:54 UTC, CRAIG DILLABAUGH wrote: Hello D Community clip Regards Craig Thanks for your effort. If someone else doesn't like it, well, I guess I don't remember a big competition among

Re: GSoC 2017 Application Rejected

2017-02-10 Thread CRAIG DILLABAUGH via Digitalmars-d-announce
On Friday, 10 February 2017 at 20:21:56 UTC, Joseph Rushton Wakeling wrote: Hi Craig, So sorry to hear that this happened. I know very well from working with you last year how much care and attention you put into GSoC, so I can imagine how you must feel right now. In the circumstances it

[Issue 5813] [patch] std.array.Appender has severe performance and memory leak problems.

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5813 --- Comment #22 from Jack Stouffer --- https://github.com/dlang/phobos/pull/5115 --

Re: Why is for() less efficient than foreach?

2017-02-10 Thread Dukc via Digitalmars-d-learn
On Friday, 10 February 2017 at 13:33:55 UTC, Bastiaan Veelo wrote: Thanks, I should have spotted that. Bastiaan. No, you don't even have to spot things like that. If you assert() the result that is. (Not a rant, half of us wouldn't probably have bothered).

Re: Best error msg ever

2017-02-10 Thread Walter Bright via Digitalmars-d
On 2/10/2017 4:41 AM, Nemanja Boric wrote: I saw it happen with D as well: everything compiles, everything is fine, and suddenly segfault. The issue was caused by template argument, two modules with the same name, but from different packages (think `myalib.blah.morebla.foo` and

Re: GSoC 2017 Application Rejected

2017-02-10 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
Hi Craig, So sorry to hear that this happened. I know very well from working with you last year how much care and attention you put into GSoC, so I can imagine how you must feel right now. In the circumstances it seems best to focus on: how could we try to stop something like this

Re: Best error msg ever

2017-02-10 Thread Sönke Ludwig via Digitalmars-d
Am 09.02.2017 um 22:44 schrieb Daniel Kozak via Digitalmars-d: Dne 9.2.2017 v 22:28 Sönke Ludwig via Digitalmars-d napsal(a): Am 09.02.2017 um 22:20 schrieb Daniel Kozak: source/app.d(51,37): Error: function dub.internal.utils.jsonFromFile (Path file, bool silent_fail = false) is not callable

Re: Updated LDC snap package with link-time optimization (LTO) support

2017-02-10 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
On Friday, 10 February 2017 at 16:37:13 UTC, Daniel Kozak wrote: http://www.phoronix.com/scan.php?page=news_item=Snaps-v-Flatpaks-Linux-Distros Please don't ask me to read that dreadful, dreadful website :-\ I have read the blogpost that article summarizes. My own feelings are: * short

Re: CTFE Status

2017-02-10 Thread Stefan Koch via Digitalmars-d
I just encountered a familiar problem again ... uint fn(uint a) { final switch(a) { case 1 : do { a++; if (a == 17) break; } while(a < 20); return a; case 2 : return 1; } } static

Re: Updated LDC snap package with link-time optimization (LTO) support

2017-02-10 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
On Friday, 10 February 2017 at 16:30:57 UTC, David Nadlinger wrote: Hmm, for whatever reason, Arch still ships 2.16 by default… Seems to work fine on Ubuntu 16.10, though. Yes, I'll ping the maintainer about it some time soon. It's possible they were holding off until after the Ubuntu 14.04

[Issue 17174] can take address of member of struct parameter in @safe code

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17174 ag0ae...@gmail.com changed: What|Removed |Added Keywords||accepts-invalid, safe

Re: GSoC 2017 Application Rejected

2017-02-10 Thread bachmeier via Digitalmars-d-announce
On Friday, 10 February 2017 at 19:00:54 UTC, CRAIG DILLABAUGH wrote: Hello D Community Just coming here to inform everyone that our D application for GSoC 2017 was sadly rejected. Unfortunately (for me) it is completely my fault, I failed to fill out one line on one of the three forms that

GSoC 2017 Application Rejected

2017-02-10 Thread CRAIG DILLABAUGH via Digitalmars-d-announce
Hello D Community Just coming here to inform everyone that our D application for GSoC 2017 was sadly rejected. Unfortunately (for me) it is completely my fault, I failed to fill out one line on one of the three forms that comprised the application. Even more frustrating I went online on

[Issue 17174] auto ref allows pointers to rvalues

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17174 Alex changed: What|Removed |Added CC||sascha.or...@gmail.com --

[Issue 17174] New: auto ref allows pointers to rvalues

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17174 Issue ID: 17174 Summary: auto ref allows pointers to rvalues Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: normal Priority:

Re: Have some down time at the year's end?

2017-02-10 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Friday, 10 February 2017 at 17:15:12 UTC, Dominikus Dittes Scherkl wrote: Hmm. For me seems like you got some comments on your PR but didn't answer. Seems plausible not to include such PR. Ah, you received those answers just now, not at that time. Sorry.

Re: Have some down time at the year's end?

2017-02-10 Thread Nemanja Boric via Digitalmars-d
On Friday, 10 February 2017 at 17:15:12 UTC, Dominikus Dittes Scherkl wrote: On Friday, 10 February 2017 at 14:36:31 UTC, Nemanja Boric wrote: On Friday, 10 February 2017 at 02:42:10 UTC, Andrei Alexandrescu wrote: On 02/09/2017 05:03 PM, Daniel Kozak wrote: Is this still accurate? I mean if I

Re: Have some down time at the year's end?

2017-02-10 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Friday, 10 February 2017 at 14:36:31 UTC, Nemanja Boric wrote: On Friday, 10 February 2017 at 02:42:10 UTC, Andrei Alexandrescu wrote: On 02/09/2017 05:03 PM, Daniel Kozak wrote: Is this still accurate? I mean if I change some issue to "trivial", is there any process which will notify you

Re: std.datetime

2017-02-10 Thread drug via Digitalmars-d-learn
10.02.2017 19:31, Jonathan M Davis via Digitalmars-d-learn пишет: On Friday, February 10, 2017 19:06:53 drug via Digitalmars-d-learn wrote: 10.02.2017 18:02, Jonathan M Davis via Digitalmars-d-learn пишет: On Friday, February 10, 2017 14:35:28 drug via Digitalmars-d-learn wrote: I found

Re: Updated LDC snap package with link-time optimization (LTO) support

2017-02-10 Thread Daniel Kozak via Digitalmars-d-announce
Dne 10.2.2017 v 17:30 David Nadlinger via Digitalmars-d-announce napsal(a): On Thursday, 9 February 2017 at 17:16:35 UTC, Joseph Rushton Wakeling wrote: This package should be possible to install on Ubuntu 16.04 or later, or Ubuntu 14.04, as well as any other distro making available a recent

Re: Updated LDC snap package with link-time optimization (LTO) support

2017-02-10 Thread David Nadlinger via Digitalmars-d-announce
On Thursday, 9 February 2017 at 17:16:35 UTC, Joseph Rushton Wakeling wrote: This package should be possible to install on Ubuntu 16.04 or later, or Ubuntu 14.04, as well as any other distro making available a recent version of snapd (2.21 or later): https://snapcraft.io/docs/core/install

Re: std.datetime

2017-02-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, February 10, 2017 19:06:53 drug via Digitalmars-d-learn wrote: > 10.02.2017 18:02, Jonathan M Davis via Digitalmars-d-learn пишет: > > On Friday, February 10, 2017 14:35:28 drug via Digitalmars-d-learn wrote: > >> I found error - years should start from 1, not 0. > >> But if months or

Re: Workaround for DIP 1005

2017-02-10 Thread Nick Treleaven via Digitalmars-d
On Thursday, 9 February 2017 at 05:40:01 UTC, Jonathan M Davis wrote: auto func(alias pred, R)(R range) if(from!"std.range.primitives".isInputRange!R && is(typeof(pred(range.front)) == bool)) {...} but you can't import std.range.primitives.front to make dynamic arrays work, whereas

Re: std.datetime

2017-02-10 Thread drug via Digitalmars-d-learn
10.02.2017 18:02, Jonathan M Davis via Digitalmars-d-learn пишет: On Friday, February 10, 2017 14:35:28 drug via Digitalmars-d-learn wrote: I found error - years should start from 1, not 0. But if months or days start from 0 std.datetime throws exception and don't for years - it isn't clear

[Issue 17131] [Reg 2.074] Fiber.state collides with differently attributed function in derived class

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17131 ZombineDev changed: What|Removed |Added CC|

[Issue 17130] [Reg 2.074] ambiguous implicit super call when inheriting core.sync.mutex.Mutex

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17130 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 17130] [Reg 2.074] ambiguous implicit super call when inheriting core.sync.mutex.Mutex

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17130 --- Comment #5 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/db81df0b6db19f5808e551a01730c15d341dc981 fix Issue 17130 - ambiguous implicit super call - need type

Re: Why do static arrays affect executable size?

2017-02-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, February 10, 2017 11:21:48 Bastiaan Veelo via Digitalmars-d-learn wrote: > // enum int maxarray = 0; > enum int maxarray = 2_000_000; > > double[maxarray] a, b, c, d; > > void main() {} > > > Compiled using "dub build --arch=x86_64 --build=release" on > Windows (DMD32 D Compiler

Re: std.datetime

2017-02-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, February 10, 2017 14:35:28 drug via Digitalmars-d-learn wrote: > I found error - years should start from 1, not 0. > But if months or days start from 0 std.datetime throws exception and > don't for years - it isn't clear that zero year is negative one (in that > mean that stdTime for

[Issue 17173] New: Incorrect return value for function accepting and returning cdouble

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17173 Issue ID: 17173 Summary: Incorrect return value for function accepting and returning cdouble Product: D Version: D2 Hardware: x86 OS: Mac OS X

[Issue 17162] std.algorithm.startsWith fails to compile with -dip1000 switch

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17162 Jack Stouffer changed: What|Removed |Added CC||j...@jackstouffer.com

Re: Beta D 2.073.1-b1

2017-02-10 Thread Jack Stouffer via Digitalmars-d-announce
On Thursday, 9 February 2017 at 00:31:17 UTC, Martin Nowak wrote: First beta for the 2.073.1 point release. This version resolves a few regressions and bugs in the 2.073.0 release. http://dlang.org/download.html#dmd_beta http://dlang.org/changelog/2.073.1.html Please report any bugs at

Re: Updated LDC snap package with link-time optimization (LTO) support

2017-02-10 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
On Thursday, 9 February 2017 at 17:16:35 UTC, Joseph Rushton Wakeling wrote: This package should be possible to install on Ubuntu 16.04 or later, or Ubuntu 14.04, as well as any other distro making available a recent version of snapd (2.21 or later): https://snapcraft.io/docs/core/install

Re: Have some down time at the year's end?

2017-02-10 Thread Nemanja Boric via Digitalmars-d
On Friday, 10 February 2017 at 02:42:10 UTC, Andrei Alexandrescu wrote: On 02/09/2017 05:03 PM, Daniel Kozak wrote: Is this still accurate? I mean if I change some issue to "trivial", is there any process which will notify you or your students about it? Or are they actively watch this list?

Re: Workaround for DIP 1005

2017-02-10 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Friday, 10 February 2017 at 13:28:43 UTC, Dominikus Dittes Scherkl wrote: Sorry, accidentally hit some key-combination that immediately send the message that was not yet complete. With my original proposal you would write auto foo(foo.SysTime st1, foo.SysTime st2,

Re: Why is for() less efficient than foreach?

2017-02-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 10 February 2017 at 12:58:19 UTC, Stefan Koch wrote: If you want it to modify the array you have to use a ref elem. If you do you will see that foreach is a little slower. Thanks, I should have spotted that. Bastiaan.

Re: Why is for() less efficient than foreach?

2017-02-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 10 February 2017 at 12:57:38 UTC, biozic wrote: On Friday, 10 February 2017 at 12:39:50 UTC, Bastiaan Veelo wrote: void foreach_loop() { foreach(n, elem; d[]) elem = a[n] * b[n] / c[n]; } It's fast because the result of the operation (elem) is

Re: Workaround for DIP 1005

2017-02-10 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Thursday, 9 February 2017 at 05:40:01 UTC, Jonathan M Davis wrote: On Friday, February 03, 2017 14:43:01 Dominikus Dittes Scherkl via Digitalmars-d wrote: Any thoughts? This is really cool, but I have a couple of concerns about this and how it seems deficient in comparison to DIP 1005.

Re: Why is for() less efficient than foreach?

2017-02-10 Thread evilrat via Digitalmars-d-learn
On Friday, 10 February 2017 at 13:13:24 UTC, evilrat wrote: On my machine (AMD FX-8350) actually almost no difference oops, it skips flags with -run -_- sorry dmd loops.d -release Function 0 took: 16 ╬╝s and 5 hnsecs Function 1 took: 55 secs, 262 ms, 844 ╬╝s, and 6 hnsecs Function 2 took:

Re: Questionnaire

2017-02-10 Thread Guillaume Piolat via Digitalmars-d-announce
On Wednesday, 8 February 2017 at 18:27:57 UTC, Ilya Yaroshenko wrote: 1. Why your company uses D? The only other real alternative (everyone using it) in my field was C++, and I have worked in a variety of C++ codebases. For me it's not a productive language and lead to inflexible programs

Re: Why is for() less efficient than foreach?

2017-02-10 Thread evilrat via Digitalmars-d-learn
On Friday, 10 February 2017 at 12:39:50 UTC, Bastiaan Veelo wrote: Depending on the machine this is run on, for() performs a factor 3-8 slower than foreach(). Can someone explain this to me? Or, taking for() as the norm, how can foreach() be so blazingly fast? Thanks! On my machine (AMD

Re: Why is for() less efficient than foreach?

2017-02-10 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 10 February 2017 at 12:39:50 UTC, Bastiaan Veelo wrote: Benchmarking for() against foreach(): / enum size_t maxarray = 500_000; double[maxarray] a, b, c, d; void main() { import std.stdio; import std.datetime; import std.random; for (int n = 0; n <

Re: Why is for() less efficient than foreach?

2017-02-10 Thread biozic via Digitalmars-d-learn
On Friday, 10 February 2017 at 12:39:50 UTC, Bastiaan Veelo wrote: void foreach_loop() { foreach(n, elem; d[]) elem = a[n] * b[n] / c[n]; } It's fast because the result of the operation (elem) is discarded on each iteration, so it is probably optimized away.

Re: Best error msg ever

2017-02-10 Thread Nemanja Boric via Digitalmars-d
On Friday, 10 February 2017 at 04:02:17 UTC, Era Scarecrow wrote: On Friday, 10 February 2017 at 02:53:50 UTC, Era Scarecrow wrote: Seems the built in Date class wasn't the same as the Sql.Date that was being used (but had the same name). Apparently it took like 2 hours to figure out what was

Why is for() less efficient than foreach?

2017-02-10 Thread Bastiaan Veelo via Digitalmars-d-learn
Benchmarking for() against foreach(): / enum size_t maxarray = 500_000; double[maxarray] a, b, c, d; void main() { import std.stdio; import std.datetime; import std.random; for (int n = 0; n < maxarray; n++) { a[n] = uniform01; b[n] = uniform01;

Re: std.datetime

2017-02-10 Thread drug via Digitalmars-d-learn
10.02.2017 14:15, drug пишет: unittest { import std.datetime : SysTime, UTC; { auto st = SysTime(); st.timezone(UTC()); long date = st.fromISOExtString("2017-02-10T00:00:00Z").stdTime, time_of_day =

Re: Can this implementation of Damm algorithm be optimized?

2017-02-10 Thread Nestor via Digitalmars-d-learn
On Thursday, 9 February 2017 at 23:49:19 UTC, Era Scarecrow wrote: Other optimizations could be to make it multiple levels, taking the basic 100 elements and expanding them 2-3 levels deep in a lookup and having it do it in more or less a single operation. (100 bytes for 1 level, 10,000 for 2

Re: Why do static arrays affect executable size?

2017-02-10 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 10 February 2017 at 11:21:48 UTC, Bastiaan Veelo wrote: // enum int maxarray = 0; enum int maxarray = 2_000_000; double[maxarray] a, b, c, d; void main() {} Compiled using "dub build --arch=x86_64 --build=release" on Windows (DMD32 D Compiler v2.073.0), the exe size is 302_592

Why do static arrays affect executable size?

2017-02-10 Thread Bastiaan Veelo via Digitalmars-d-learn
// enum int maxarray = 0; enum int maxarray = 2_000_000; double[maxarray] a, b, c, d; void main() {} Compiled using "dub build --arch=x86_64 --build=release" on Windows (DMD32 D Compiler v2.073.0), the exe size is 302_592 bytes v.s. 64_302_592 bytes, depending on the array length. Is that

std.datetime

2017-02-10 Thread drug via Digitalmars-d-learn
unittest { import std.datetime : SysTime, UTC; { auto st = SysTime(); st.timezone(UTC()); long date = st.fromISOExtString("2017-02-10T00:00:00Z").stdTime, time_of_day =

Re: Questionnaire

2017-02-10 Thread Claude via Digitalmars-d-announce
1. Why your company uses D? My company does not use D. If I had the time, I really think I could integrate D into our build system, probably forcing it a bit: "Oh and by the way, that new library I wrote happens to be written in D..." (We have Vala in our build system, how worse could it

[Issue 17171] ddoc: enum misses some values + wrong order + missing member initializers

2017-02-10 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17171 Jacob Carlborg changed: What|Removed |Added CC||d...@me.com --- Comment #1

Re: Initialization of dynamic multidimensional array

2017-02-10 Thread berni via Digitalmars-d-learn
On Friday, 10 February 2017 at 09:34:39 UTC, berni wrote: On Friday, 10 February 2017 at 09:25:04 UTC, Daniel Kozak wrote: Now I tried this with a named instead of a magic constant e.g. immutable VALUE=-1; arr.each!"a[]=VALUE"; And it doesn't work anymore. I've no clue, why... Can you help

Re: Initialization of dynamic multidimensional array

2017-02-10 Thread berni via Digitalmars-d-learn
On Friday, 10 February 2017 at 09:25:04 UTC, Daniel Kozak wrote: Now I tried this with a named instead of a magic constant e.g. immutable VALUE=-1; arr.each!"a[]=VALUE"; And it doesn't work anymore. I've no clue, why... Can you help me? Because it does not see VALUE, you need to use

Re: Initialization of dynamic multidimensional array

2017-02-10 Thread Mike Parker via Digitalmars-d-learn
On Friday, 10 February 2017 at 09:03:16 UTC, berni wrote: Now I tried this with a named instead of a magic constant e.g. immutable VALUE=-1; arr.each!"a[]=VALUE"; And it doesn't work anymore. I've no clue, why... Can you help me? each is a template. As per the template documentation

Re: Initialization of dynamic multidimensional array

2017-02-10 Thread Daniel Kozak via Digitalmars-d-learn
Dne 10.2.2017 v 10:03 berni via Digitalmars-d-learn napsal(a): On Tuesday, 7 February 2017 at 19:06:22 UTC, berni wrote: auto arr = uninitializedArray!(int[][])(ROWS,COLS); arr.each!"a[]=-1"; This looks like what I was looking for. At least I think I understand what's going on here. The

Re: Initialization of dynamic multidimensional array

2017-02-10 Thread berni via Digitalmars-d-learn
On Tuesday, 7 February 2017 at 19:06:22 UTC, berni wrote: auto arr = uninitializedArray!(int[][])(ROWS,COLS); arr.each!"a[]=-1"; This looks like what I was looking for. At least I think I understand what's going on here. The other two suggestions are beyond my scope yet, but I'll come back,

Re: Strange behaviour of rdmd vs. dmd concerning main function

2017-02-10 Thread berni via Digitalmars-d-learn
$> dmd Special/special.d Common/common.o Special/special.d(4): Error: module common is in file 'common.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import This is not a linker error. It's a compiler error. You need common.d for