Re: how convert the range to slice ?

2015-02-02 Thread Nordlöw
On Monday, 2 February 2015 at 19:04:52 UTC, Nordlöw wrote: https://github.com/nordlow/dmd/commit/40ce0ecf34f90c4d3053c47e9286d7574f596e15 Made it PR at https://github.com/D-Programming-Language/dmd/pull/4371

Visual D prematurely closes the console

2015-02-02 Thread Dennis Ritchie via Digitalmars-d-learn
Hi. Visual D are settings in the project parameter Subsystem mode Console and command line with output still closes prematurely. How to make the command line was not closed prematurely without using system(pause)?

Re: Visual D prematurely closes the console

2015-02-02 Thread Ali Çehreli via Digitalmars-d-learn
On 02/02/2015 01:51 PM, Dennis Ritchie wrote: Hi. Visual D are settings in the project parameter Subsystem mode Console and command line with output still closes prematurely. How to make the command line was not closed prematurely without using system(pause)? I think the answer is the same

Re: Visual D prematurely closes the console

2015-02-02 Thread FrankLike via Digitalmars-d-learn
On Monday, 2 February 2015 at 22:58:06 UTC, Dennis Ritchie wrote: On Monday, 2 February 2015 at 22:14:36 UTC, Ali Çehreli wrote: http://stackoverflow.com/questions/454681/how-to-keep-the-console-window-open-in-visual-c Not helped: http://i.imgur.com/4EG84YK.png Use monoD do a hello world

Re: Visual D prematurely closes the console

2015-02-02 Thread Dennis Ritchie via Digitalmars-d-learn
On Monday, 2 February 2015 at 23:08:13 UTC, FrankLike wrote: Use monoD do a hello world ,you will get the answer. And Mono-D good debugger?

Re: Visual D prematurely closes the console

2015-02-02 Thread Dennis Ritchie via Digitalmars-d-learn
On Monday, 2 February 2015 at 22:14:36 UTC, Ali Çehreli wrote: http://stackoverflow.com/questions/454681/how-to-keep-the-console-window-open-in-visual-c Not helped: http://i.imgur.com/4EG84YK.png

Re: Visual D prematurely closes the console

2015-02-02 Thread Dennis Ritchie via Digitalmars-d-learn
I found the right option! http://imgur.com/KfkuBZi

Re: cast a C char array - offset ?

2015-02-02 Thread irtcupc via Digitalmars-d-learn
On Monday, 2 February 2015 at 12:42:24 UTC, FG wrote: On 2015-02-02 at 13:16, irtcupc wrote: The manual section about interfacing from c states that type[] is inter-compatible from C to D, however, I face this strange case: - C declaration: char identifier[64]; - D declaration: char[64]

Re: cast a C char array - offset ?

2015-02-02 Thread irtcupc via Digitalmars-d-learn
On Monday, 2 February 2015 at 13:34:28 UTC, ketmar wrote: On Mon, 02 Feb 2015 13:32:57 +, ketmar wrote: On Mon, 02 Feb 2015 13:23:23 +, irtcupc wrote: my current understanding is that: - C: char CompleteInstr[INSTRUCT_LENGTH] is actually a raw chunk - D: defining the member as

Re: Conway's game of life

2015-02-02 Thread FG via Digitalmars-d-learn
On 2015-02-02 at 12:23, FG wrote: Cell(0,3) is not a neighbour bit fits the (diff1 == 1 || diff2 == 1) criterion. s/bit/but/

Re: Conway's game of life

2015-02-02 Thread FG via Digitalmars-d-learn
Bloody Thunderbird has sent a reply to the OP and not to the NG. On 2015-02-02 at 11:45, gedaiu wrote: I don't think that the line of code is wrong. If use the function will check for neighbours only on diagonals. Having || allows the search on the vertical and horizontal axis and diagonals.

Re: Conway's game of life

2015-02-02 Thread gedaiu via Digitalmars-d-learn
Uf... you are right! I've fixed it. Thanks! On Monday, 2 February 2015 at 11:23:17 UTC, FG wrote: Bloody Thunderbird has sent a reply to the OP and not to the NG. On 2015-02-02 at 11:45, gedaiu wrote: I don't think that the line of code is wrong. If use the function will check for

Re: cast a C char array - offset ?

2015-02-02 Thread FG via Digitalmars-d-learn
On 2015-02-02 at 13:16, irtcupc wrote: The manual section about interfacing from c states that type[] is inter-compatible from C to D, however, I face this strange case: - C declaration: char identifier[64]; - D declaration: char[64] identifier; - the result is only correct if i slice by (-

Re: cast a C char array - offset ?

2015-02-02 Thread ketmar via Digitalmars-d-learn
On Mon, 02 Feb 2015 13:23:23 +, irtcupc wrote: my current understanding is that: - C: char CompleteInstr[INSTRUCT_LENGTH] is actually a raw chunk - D: defining the member as char[INSTRUCT_LENGTH] is an error - the first member of a D array is the .length - first char actually stands where

Re: cast a C char array - offset ?

2015-02-02 Thread ketmar via Digitalmars-d-learn
On Mon, 02 Feb 2015 13:32:57 +, ketmar wrote: On Mon, 02 Feb 2015 13:23:23 +, irtcupc wrote: my current understanding is that: - C: char CompleteInstr[INSTRUCT_LENGTH] is actually a raw chunk - D: defining the member as char[INSTRUCT_LENGTH] is an error - the first member of a D

Re: Time from timestamp?

2015-02-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/31/15 1:07 AM, Jonathan M Davis via Digitalmars-d-learn wrote: On Friday, January 30, 2015 22:03:02 Jonathan M Davis via Digitalmars-d-learn wrote: Yeah. I really should add a unixTimeToSysTime function, Actually, maybe it should be a static function on SysTime called fromUnixTime to go

Re: cast a C char array - offset ?

2015-02-02 Thread Mike Parker via Digitalmars-d-learn
On 2/2/2015 9:16 PM, irtcupc wrote: The manual section about interfacing from c states that type[] is inter-compatible from C to D, however, I face this strange case: - C declaration: char identifier[64]; - D declaration: char[64] identifier; - the result is only correct if i slice by (-

Re: cast a C char array - offset ?

2015-02-02 Thread irtcupc via Digitalmars-d-learn
On Monday, 2 February 2015 at 12:57:37 UTC, Mike Parker wrote: On 2/2/2015 9:16 PM, irtcupc wrote: The manual section about interfacing from c states that type[] is inter-compatible from C to D, however, I face this strange case: - C declaration: char identifier[64]; - D declaration:

Re: cast a C char array - offset ?

2015-02-02 Thread FG via Digitalmars-d-learn
On 2015-02-02 at 14:40, irtcupc wrote: On Monday, 2 February 2015 at 13:34:28 UTC, ketmar wrote: struct _Disasm { align(1): the difference is that `align` before struct tells how structure should be packed (i.e. when you have `_Disasm[2] arr`). and `align` *inside* struct tells compiler

Re: strlen, strcpy, etc errors when trying to link an object

2015-02-02 Thread irtcupc via Digitalmars-d-learn
On Monday, 2 February 2015 at 05:30:04 UTC, ketmar wrote: On Sun, 01 Feb 2015 18:34:01 +, irtcupc wrote: did you build BeaEngine with dmc? if not, try to rebuild with dmc compiler. It has worked, compiled with dmc, __IBMCPP__ compatibility mode, thx for pointing me out the idea.

Re: Conway's game of life

2015-02-02 Thread gedaiu via Digitalmars-d-learn
I don't think that the line of code is wrong. If use the function will check for neighbours only on diagonals. Having || allows the search on the vertical and horizontal axis and diagonals. There are some tests that check the function: unittest { CellList world = [ Cell(0,0), Cell(0,1),

Re: Conway's game of life

2015-02-02 Thread gedaiu via Digitalmars-d-learn
It's true that I have to change that function. Thanks for the notice! Why do you think that D's GC is crap? On Sunday, 1 February 2015 at 21:54:43 UTC, Foo wrote: On Sunday, 1 February 2015 at 21:00:07 UTC, gedaiu wrote: Hi, I implemented Conway's game of life in D. What do you think

cast a C char array - offset ?

2015-02-02 Thread irtcupc via Digitalmars-d-learn
The manual section about interfacing from c states that type[] is inter-compatible from C to D, however, I face this strange case: - C declaration: char identifier[64]; - D declaration: char[64] identifier; - the result is only correct if i slice by (- pointer size): char[64] fromC(char[64]

Struct destructor in a with block

2015-02-02 Thread Tofu Ninja via Digitalmars-d-learn
module main; import std.stdio; void main(string[] args) { with(test()) { foo(); } } struct test { void foo() { writeln(foo); } ~this() { writeln(destoy); } } prints:

Re: Struct destructor in a with block

2015-02-02 Thread Tofu Ninja via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 05:09:55 UTC, Ali Çehreli wrote: Yes, it's a known bug that has been fixed on git head but I can't find the bug report. :-/ Ok cool, good to know. The new output: foo destoy Yes, without the 'r'. ;) Ali Yeah, i noticed the typo right after I posted...

Re: Struct destructor in a with block

2015-02-02 Thread Ali Çehreli via Digitalmars-d-learn
On 02/02/2015 07:51 PM, Tofu Ninja wrote: module main; import std.stdio; void main(string[] args) { with(test()) { foo(); } } struct test { void foo() { writeln(foo); } ~this() { writeln(destoy); } } prints: destroy

Re: Time from timestamp?

2015-02-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/2/15 10:06 AM, Jonathan M Davis via Digitalmars-d-learn wrote: On Monday, February 02, 2015 08:49:58 Steven Schveighoffer via Digitalmars-d-learn wrote: On 1/31/15 1:07 AM, Jonathan M Davis via Digitalmars-d-learn wrote: On Friday, January 30, 2015 22:03:02 Jonathan M Davis via

GDB C++ Tip

2015-02-02 Thread via Digitalmars-d-learn
FYI http://stackoverflow.com/questions/28279395/printing-sub-class-members-in-gdb This is makes DMD debugging more enjoyable :)

Re: Time from timestamp?

2015-02-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 02, 2015 08:49:58 Steven Schveighoffer via Digitalmars-d-learn wrote: On 1/31/15 1:07 AM, Jonathan M Davis via Digitalmars-d-learn wrote: On Friday, January 30, 2015 22:03:02 Jonathan M Davis via Digitalmars-d-learn wrote: Yeah. I really should add a unixTimeToSysTime

Re: how convert the range to slice ?

2015-02-02 Thread bearophile via Digitalmars-d-learn
Nordlöw: Is started digging a bit... The magic happens at line 103 in cast.c. How do I most conveniently figure out which members (functions) a type (e-type) has? I figured I could check for typical InputRange members and issue a hint about using .array if e-type has them. It's probably

Re: Conway's game of life

2015-02-02 Thread bearophile via Digitalmars-d-learn
gedaiu: https://github.com/gedaiu/Game-Of-Life-D A bare-bones implementation: http://rosettacode.org/wiki/Conway%27s_Game_of_Life#Faster_Version The quality of the D GC is not important for a simple Life implementation, you just need two arrays. Bye, bearophile

Re: std.algorithm sort() and reverse() confusion

2015-02-02 Thread bearophile via Digitalmars-d-learn
Jonathan M Davis: arr.reverse.map!sqrt Yes, but arguably, chaining calls in this case is bad, We have discussed this some time... and I'd like reverse() to return the original array (like the deprecated array .reverse property). It's not a perfect design, but allowing UFCS chains is

Re: how convert the range to slice ?

2015-02-02 Thread Nordlöw
On Monday, 2 February 2015 at 16:56:02 UTC, bearophile wrote: Nordlöw: Is started digging a bit... The magic happens at line 103 in cast.c. How do I most conveniently figure out which members (functions) a type (e-type) has? I figured I could check for typical InputRange members and

Re: windows wininet library

2015-02-02 Thread Kagamin via Digitalmars-d-learn
http://sourceforge.net/p/mingw/mingw-org-wsl/ci/master/tree/lib/lib32/wininet.def ?