Silicon Valley D Meetup - September 28, 2017 - "Open Methods: From C++ to D" by Jean-Louis Leroy

2017-09-18 Thread Ali Çehreli via Digitalmars-d-announce
We're excited to be in San Francisco this month: https://www.meetup.com/D-Lang-Silicon-Valley/events/243022411/ Our host is AdRoll[1]. Ali [1] AdRoll uses D for data science: http://tech.adroll.com/blog/data/2014/11/17/d-is-for-data-science.html

Re: The case for integer overflow checks?

2017-09-18 Thread Jonathan M Davis via Digitalmars-d
On Monday, September 18, 2017 22:39:09 Moritz Maxeiner via Digitalmars-d wrote: > On Monday, 18 September 2017 at 22:32:28 UTC, Dennis Cote wrote: > > On Monday, 18 September 2017 at 13:25:55 UTC, Andrei > > > > Alexandrescu wrote: > >> For the record, with the help of

D for Android

2017-09-18 Thread Joakim via Digitalmars-d
Almost four years ago, I asked where Android was at, in this thread about supporting ARM, and decided to take up the port: http://forum.dlang.org/thread/yhulkqvlwnxjklnog...@forum.dlang.org After releasing linux/x64 cross-compilers for the last couple years, I finally got all my patches

Re: The case for integer overflow checks?

2017-09-18 Thread Moritz Maxeiner via Digitalmars-d
On Monday, 18 September 2017 at 22:32:28 UTC, Dennis Cote wrote: On Monday, 18 September 2017 at 13:25:55 UTC, Andrei Alexandrescu wrote: For the record, with the help of std.experimental.checkedint, the change that fixes the code would be: malloc(width * height * 4) ==>

Re: The case for integer overflow checks?

2017-09-18 Thread Dennis Cote via Digitalmars-d
On Monday, 18 September 2017 at 13:25:55 UTC, Andrei Alexandrescu wrote: For the record, with the help of std.experimental.checkedint, the change that fixes the code would be: malloc(width * height * 4) ==> malloc((checked(width) * height * 4).get) That aborts the application with a message

Re: cannot access frame of function

2017-09-18 Thread Alex via Digitalmars-d-learn
On Monday, 18 September 2017 at 18:49:54 UTC, ag0aep6g wrote: Doesn't work for me. This still fails compilation with the same error: import std.algorithm.iteration : sum, cumulativeFold; void main() { double[5] a; auto asum = 1.23; auto jProbs = a[].cumulativeFold!((a, b) =>

Re: scope(exit) and destructor prioity

2017-09-18 Thread Moritz Maxeiner via Digitalmars-d-learn
On Monday, 18 September 2017 at 20:55:21 UTC, Sasszem wrote: If I write "auto a = new De()", then it calls the scope first, no matter where I place it. Because with `new` a) your struct object is located on the heap (and referred to by pointer - `De*`) instead of the stack (which means no

Re: scope(exit) and destructor prioity

2017-09-18 Thread Eugene Wissner via Digitalmars-d-learn
On Monday, 18 September 2017 at 20:55:21 UTC, Sasszem wrote: On Monday, 18 September 2017 at 20:30:20 UTC, Jerry wrote: On Monday, 18 September 2017 at 20:26:05 UTC, Sasszem wrote: [...] It's called inbetween the destructors of wherever you put the scope(exit). import std.stdio; struct

Re: scope(exit) and destructor prioity

2017-09-18 Thread Sasszem via Digitalmars-d-learn
On Monday, 18 September 2017 at 20:30:20 UTC, Jerry wrote: On Monday, 18 September 2017 at 20:26:05 UTC, Sasszem wrote: [...] It's called inbetween the destructors of wherever you put the scope(exit). import std.stdio; struct De { ~this() { writeln("De"); } } void main() {

Trial v0.4.0 and visual-trial v0.1.0 are out

2017-09-18 Thread Szabo Bogdan via Digitalmars-d-announce
Hi! I want to announce that I managed to release a new version of Trial, the DLang test runner. Since my last announcement, I made this changes: - new TAP and VisualTrial reporters - add -r flag to override the default reporters - add the describe command which prints a json with the

Re: scope(exit) and destructor prioity

2017-09-18 Thread Jerry via Digitalmars-d-learn
On Monday, 18 September 2017 at 20:26:05 UTC, Sasszem wrote: I'm currently working on a project and for that I've created a thin OO-wrapper on top of derelict-sdl. However, when I close my app, the program terminates with a segfault. I've managed to track down the source, and found that the

scope(exit) and destructor prioity

2017-09-18 Thread Sasszem via Digitalmars-d-learn
I'm currently working on a project and for that I've created a thin OO-wrapper on top of derelict-sdl. However, when I close my app, the program terminates with a segfault. I've managed to track down the source, and found that the destructors of my objects are called AFTER the scope(exit)

[Issue 17838] New: rdmd file-descriptor issues with snap packages

2017-09-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17838 Issue ID: 17838 Summary: rdmd file-descriptor issues with snap packages Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement

Re: cannot access frame of function

2017-09-18 Thread user1234 via Digitalmars-d-learn
On Monday, 18 September 2017 at 18:49:54 UTC, ag0aep6g wrote: On 09/18/2017 08:25 PM, user1234 wrote: On Monday, 18 September 2017 at 14:45:25 UTC, Alex wrote: [...] import std.algorithm.iteration : sum, cumulativeFold; void main() { double[5] a; [...]>> auto asum = a[].sum; [...]

Re: Looking for instructions on how to make a Derelict library

2017-09-18 Thread Matt Jones via Digitalmars-d-learn
On Monday, 18 September 2017 at 11:27:01 UTC, jmh530 wrote: On Monday, 18 September 2017 at 00:33:25 UTC, Matt Jones wrote: I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too. Thanks. Might be interesting to write up

Re: cannot access frame of function

2017-09-18 Thread ag0aep6g via Digitalmars-d-learn
On 09/18/2017 08:25 PM, user1234 wrote: On Monday, 18 September 2017 at 14:45:25 UTC, Alex wrote: [...] import std.algorithm.iteration : sum, cumulativeFold; void main() { double[5] a; [...]>> auto asum = a[].sum; [...] asum is a lazy range and the error comes from this. asum is

Re: cannot access frame of function

2017-09-18 Thread user1234 via Digitalmars-d-learn
On Monday, 18 September 2017 at 14:45:25 UTC, Alex wrote: Hi all, given this code: import std.algorithm.iteration : sum, cumulativeFold; void main() { double[5] a; a = 0; foreach(el; a) assert(el == 0); a[0] = 1.0; a[1] = 2.0; a[2] = 3.0;

Re: The case for integer overflow checks?

2017-09-18 Thread Ola Fosheim Grøstad via Digitalmars-d
On Monday, 18 September 2017 at 11:42:19 UTC, Kagamin wrote: Do they check unsigned integers? No, I don't believe they do, as unsigned integers are modular in C/C++. (And in D also signed integers are modular).

Re: The case for integer overflow checks?

2017-09-18 Thread Ola Fosheim Grøstad via Digitalmars-d
On Monday, 18 September 2017 at 14:36:35 UTC, Jonathan M Davis wrote: We have std.experimental.checkedint, so why would there be any need for it to be in the compiler? The library solution provides the functionality and does so in a much more flexible manner than the compiler reasonably could.

Re: OpIndex/OpIndexAssign strange order of execution

2017-09-18 Thread SrMordred via Digitalmars-d-learn
void main() { auto s = S(); s["b", "c"] = s["a"]; } Prints a ["b", "c"] Ali I thought about this too, thanks!

Re: OpIndex/OpIndexAssign strange order of execution

2017-09-18 Thread Ali Çehreli via Digitalmars-d-learn
Have you considered the multiple indexes? https://dlang.org/spec/operatoroverloading.html#index_assignment_operator It may give you some power in execution order. import std.stdio; struct S { auto opIndex(string index) { writeln(index); return 42; } auto

Re: OpIndex/OpIndexAssign strange order of execution

2017-09-18 Thread SrMordred via Digitalmars-d-learn
On Monday, 18 September 2017 at 15:14:20 UTC, Moritz Maxeiner wrote: On Monday, 18 September 2017 at 15:11:34 UTC, Moritz Maxeiner wrote: gets rewritten to --- t.opIndex("b").opIndexAssign(t["a"].value, "c"); --- Sorry, forgot one level of rewriting: ---

[Issue 17836] ICE with custom 'map' template

2017-09-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17836 --- Comment #3 from Iain Buclaw --- (In reply to Iain Buclaw from comment #2) > > The front-end should ideally have a way to notify the code generator of this > somehow, to notify us that there's no need to check whether the

[Issue 17375] colliding modules detected with binutils 2.28 linker and shared libraries

2017-09-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17375 --- Comment #11 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/3d36e434b84cf6ebd7341aaffe2b3b0b588a0262 Issue 17375 - use -fPIC by default for Phobos on Posix

Re: My friend can't install DMD 2.076.0 after he deleted contents of C:\D

2017-09-18 Thread Moritz Maxeiner via Digitalmars-d-learn
On Sunday, 17 September 2017 at 05:33:12 UTC, rikki cattermole wrote: Skip Revo-Uninstaller, no idea why you'd ever use such trial software. Anyway what you want is CCleaner, standard software that all Windows installs should have on hand.

Re: My friend can't install DMD 2.076.0 after he deleted contents of C:\D

2017-09-18 Thread Andre Kostur via Digitalmars-d-learn
On 2017-09-16 10:33 PM, rikki cattermole wrote: On 17/09/2017 6:30 AM, Enjoys Math wrote: Series of messages from installer: DMD v2.076.0 is installed on your system Press 'OK' to replace by DMD 2.076.0 An error occurred when removing DMD v2.076.0 Run 'dmd-2.076.0.exe /f to force install And

Re: OpIndex/OpIndexAssign strange order of execution

2017-09-18 Thread Moritz Maxeiner via Digitalmars-d-learn
On Monday, 18 September 2017 at 15:11:34 UTC, Moritz Maxeiner wrote: gets rewritten to --- t.opIndex("b").opIndexAssign(t["a"].value, "c"); --- Sorry, forgot one level of rewriting: --- t.opIndex("b").opIndexAssign(t.opIndex("a").value, "c"); ---

Re: OpIndex/OpIndexAssign strange order of execution

2017-09-18 Thread Moritz Maxeiner via Digitalmars-d-learn
On Sunday, 17 September 2017 at 18:52:39 UTC, SrMordred wrote: struct Test{ [...] } Test t; As described in the spec [1] t["a"] = 100; gets rewritten to --- t.opIndexAssign(100, "a"); --- , while t["b"]["c"] = t["a"].value; gets rewritten to ---

cannot access frame of function

2017-09-18 Thread Alex via Digitalmars-d-learn
Hi all, given this code: import std.algorithm.iteration : sum, cumulativeFold; void main() { double[5] a; a = 0; foreach(el; a) assert(el == 0); a[0] = 1.0; a[1] = 2.0; a[2] = 3.0; a[3] = 4.0; a[4] = 5.0; foreach(el; a)

Re: Looking for instructions on how to make a Derelict library

2017-09-18 Thread SrMordred via Digitalmars-d-learn
I used to have a guide to creating "Derelictified" bindings for an older version. I should write one up for the current version. +1

Re: The case for integer overflow checks?

2017-09-18 Thread Jonathan M Davis via Digitalmars-d
On Monday, September 18, 2017 08:35:44 Ola Fosheim Grøstad via Digitalmars-d wrote: > On Monday, 18 September 2017 at 08:27:21 UTC, Jonathan M Davis > > wrote: > > There also really isn't a need to do so. > > If there was no need then C/C++ compilers wouldn't provide it as > an option… We have

Re: Looking for instructions on how to make a Derelict library

2017-09-18 Thread Mike Parker via Digitalmars-d-learn
On Monday, 18 September 2017 at 11:27:01 UTC, jmh530 wrote: On Monday, 18 September 2017 at 00:33:25 UTC, Matt Jones wrote: I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too. Thanks. Might be interesting to write up

Re: OpIndex/OpIndexAssign strange order of execution

2017-09-18 Thread SrMordred via Digitalmars-d-learn
Should I report this as a bug? I tried a C++ equivalent code and it execute in the expected order.

Re: The case for integer overflow checks?

2017-09-18 Thread Andrei Alexandrescu via Digitalmars-d
On 09/15/2017 04:46 AM, Guillaume Piolat wrote: As a die-hard native programmer I was always disgusted by integer overflow checks and array bounds checks. Littering code with branches everywhere? Just let me go as fast possible please! Last week I was explained by security people how a part

Re: Question on Container Array.

2017-09-18 Thread Eugene Wissner via Digitalmars-d-learn
On Monday, 18 September 2017 at 11:47:07 UTC, Vino.B wrote: Hi All, Can some one explain me on the below question. Q1: void main (Array!string args) : Why can't we use container array in void main? Q2: What is the difference between the below? insert, insertBack stableInsert,

[Issue 17747] extern(C) shared static module constructor should be called in betterC programs

2017-09-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17747 --- Comment #10 from Steven Schveighoffer --- (In reply to anonymous4 from comment #9) > (In reply to Steven Schveighoffer from comment #8) > > People are used to this "just working". > Same problem for other usage of extern(C).

[Issue 15064] [CTFE] AliasSeq in multi-level alias this fails in CTFE

2017-09-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15064 Simen Kjaeraas changed: What|Removed |Added CC|

Question on Container Array.

2017-09-18 Thread Vino.B via Digitalmars-d-learn
Hi All, Can some one explain me on the below question. Q1: void main (Array!string args) : Why can't we use container array in void main? Q2: What is the difference between the below? insert, insertBack stableInsert, stableInsertBack linearInsert, stableLinearInsert, stableLinearInsert

Re: The case for integer overflow checks?

2017-09-18 Thread Kagamin via Digitalmars-d
On Monday, 18 September 2017 at 08:35:44 UTC, Ola Fosheim Grøstad wrote: If there was no need then C/C++ compilers wouldn't provide it as an option… Do they check unsigned integers?

Re: The case for integer overflow checks?

2017-09-18 Thread Guillaume Piolat via Digitalmars-d
On Monday, 18 September 2017 at 08:27:21 UTC, Jonathan M Davis wrote: If you care about having the overflow checks On Monday, 18 September 2017 at 08:27:21 UTC, Jonathan M Davis wrote: Personally, I've never had a need for checked ints. I've rarely seen code that would care, and when you

Re: Looking for instructions on how to make a Derelict library

2017-09-18 Thread jmh530 via Digitalmars-d-learn
On Monday, 18 September 2017 at 00:33:25 UTC, Matt Jones wrote: I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too. Thanks. Might be interesting to write up your experience with doing it as either blog post or part of

Re: extern(C) enum

2017-09-18 Thread Moritz Maxeiner via Digitalmars-d-learn
On Monday, 18 September 2017 at 02:04:49 UTC, bitwise wrote: The following code will run fine on Windows, but crash on iOS due to the misaligned access: Interesting, does iOS crash such a process intentionally, or is it a side effect? char data[8]; int i = 0x; int* p =

[Issue 17747] extern(C) shared static module constructor should be called in betterC programs

2017-09-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17747 --- Comment #9 from anonymous4 --- (In reply to Steven Schveighoffer from comment #8) > People are used to this "just working". Same problem for other usage of extern(C). --

Re: The case for integer overflow checks?

2017-09-18 Thread Ola Fosheim Grøstad via Digitalmars-d
On Monday, 18 September 2017 at 08:27:21 UTC, Jonathan M Davis wrote: There also really isn't a need to do so. If there was no need then C/C++ compilers wouldn't provide it as an option…

Re: The case for integer overflow checks?

2017-09-18 Thread Jonathan M Davis via Digitalmars-d
On Friday, September 15, 2017 19:01:18 Walter Bright via Digitalmars-d wrote: > On 9/15/2017 5:00 PM, bitwise wrote: > > On Friday, 15 September 2017 at 21:21:01 UTC, Walter Bright wrote: > >> https://dlang.org/phobos/std_experimental_checkedint.html > > > > Will this ever be integrated directly

OT: Updating "Organizations using the D Language" page

2017-09-18 Thread Ali Çehreli via Digitalmars-d
On 09/16/2017 12:38 PM, Answar Enchali wrote: > I work for a company Eco-Médias Tech and we would like to invest in > adding D support to our current in house IDE. It would be nice if you don't mind adding your company to the following page. https://dlang.org/orgs-using-d.html Thanks, Ali

[Issue 17837] Static array initializers longer than array length should not be allowed

2017-09-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17837 b2.t...@gmx.com changed: What|Removed |Added CC||b2.t...@gmx.com --- Comment #1 from

[Issue 15064] [CTFE] std.range.enumerate is not CTFE-able

2017-09-18 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15064 b2.t...@gmx.com changed: What|Removed |Added CC||b2.t...@gmx.com --- Comment #4 from