Re: Range violation error when reading from a file

2019-06-17 Thread aliak via Digitalmars-d-learn
On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote: Also, if I run the program below with the same file, I don't get any range violation errors: Ya, writeln will not access individual elements of a range if there aren't any. So no violations occur. HOWEVER, the output is interesting.

Re: Just another question about memory management in d from a newbie

2019-06-17 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jun 17, 2019 at 07:53:52PM +, Thomas via Digitalmars-d-learn wrote: [...] > int main() > { > foreach(i;0 .. 1) > { > int x; > // do something with x > } > return 0; > } > > Do I understand it right that the variable x will be created 1 > times

Re: How does this template work?

2019-06-17 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-06-16 15:14:37 +, rikki cattermole said: observerObject is an eponymous template. What this means (in essence) is the symbol inside the template block == template block. Hmm... ok. Is there any reason to have these "eponymous templates"? I don't see any benefit... -- Robert

Just another question about memory management in d from a newbie

2019-06-17 Thread Thomas via Digitalmars-d-learn
Hello! First my background: C++ and Java ages ago. Since then only PLSQL. Now learning D just for fun and personal education on time to time and very pleased about it :-) Now I have to ask a question here, because I could not find a corresponding answer for it. Or I am unable to find it :-)

Re: Just another question about memory management in d from a newbie

2019-06-17 Thread Thomas via Digitalmars-d-learn
On Monday, 17 June 2019 at 20:26:28 UTC, H. S. Teoh wrote: On Mon, Jun 17, 2019 at 07:53:52PM +, Thomas via Digitalmars-d-learn wrote: [...] [...] If x were a heap-allocated object, then your concerns would be true: it would be allocated once every iteration (and also add to the garbage

Re: Just another question about memory management in d from a newbie

2019-06-17 Thread Thomas via Digitalmars-d-learn
First, thank you for your fast reply! On Monday, 17 June 2019 at 20:00:34 UTC, Adam D. Ruppe wrote: No, the compiler will generate code to reuse the same thing each loop. Does this code also work on complex types like structs ?

Re: How does this template work?

2019-06-17 Thread aliak via Digitalmars-d-learn
On Monday, 17 June 2019 at 18:25:24 UTC, Robert M. Münch wrote: On 2019-06-16 15:14:37 +, rikki cattermole said: observerObject is an eponymous template. What this means (in essence) is the symbol inside the template block == template block. Hmm... ok. Is there any reason to have these

Re: Just another question about memory management in d from a newbie

2019-06-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 17 June 2019 at 19:53:52 UTC, Thomas wrote: Do I understand it right that the variable x will be created 1 times and destroyed at the end of the scope in each loop ? Or will it be 1 overwritten by creation ? No, the compiler will generate code to reuse the same thing each

Specifying executable names in DUB

2019-06-17 Thread Dave via Digitalmars-d-learn
Greetings, This might be totally obvious, but I can't seem to figure out how to specify an executable's name to be different for each build types in my DUB package. For example, if my project is named "dlang_test", I might want something like so: dub build --build=debug yields either

Re: Specifying executable names in DUB

2019-06-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, June 17, 2019 8:13:46 PM MDT Dave via Digitalmars-d-learn wrote: > Greetings, > > This might be totally obvious, but I can't seem to figure out how > to specify an executable's name to be different for each > build types in my DUB package. For example, if my project is > named

Re: Specifying executable names in DUB

2019-06-17 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 02:13:46 UTC, Dave wrote: Greetings, This might be totally obvious, but I can't seem to figure out how to specify an executable's name to be different for each build types in my DUB package. For example, if my project is named "dlang_test", I might want something

Re: Range violation error when reading from a file

2019-06-17 Thread Samir via Digitalmars-d-learn
On Monday, 17 June 2019 at 03:46:11 UTC, Norm wrote: On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote: Any suggestions on how to rectify? You could change the IF to `if(line.length > 0 && line[0] == '>')` Thanks, Norm. That seemed to do the trick and fixed the error. On Monday, 17

Re: CT/RT annoyance

2019-06-17 Thread user1234--- via Digitalmars-d-learn
On Monday, 17 June 2019 at 05:04:50 UTC, Bart wrote: Consider void foo(string A = "")(string B = "") { static if (A != "") do(A); else do(B); } [...] I see the annoyance but D clearly separates what is CT and RT so such a change would require a DIP. I don't even know

Where can find dmd back-end source code.

2019-06-17 Thread lili via Digitalmars-d-learn
Hi gues: I clone the dmd source code from github but i can find backend code. there is a backend dir in src but can not find x86 native code generator. and the dmd wiki page just say Back end FileFunction html.c Extracts D source code from .html files but source can't find html.c

Re: Where can find dmd back-end source code.

2019-06-17 Thread rikki cattermole via Digitalmars-d-learn
You found it. https://github.com/dlang/dmd/tree/master/src/dmd/backend Generates x86 and x86_64.

Re: Where can find dmd back-end source code.

2019-06-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 17 June 2019 at 16:41:00 UTC, lili wrote: html.c Extracts D source code from .html files but source can't find html.c file. that file (and associated feature) was removed a long time ago, the wiki is out of date. but the rest of the x86 code generation should all be there in

Re: Blog Post #0043 - File Dialog IX - Custom Dialogs (2 of 3)

2019-06-17 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 09:06:10 UTC, Ron Tarrant wrote: This is the second in a series (Custom Dialogs) within a series (Dialogs) and deals with the action area. It's available here: http://gtkdcoding.com/2019/06/11/0043-custom-dialog-ii.html Aw man, your content have. "© Copyright 2019

System requirements for compiling/linking big D codebases

2019-06-17 Thread Yatheendra via Digitalmars-d-learn
Hi, For the sake of people habituated to compiling compilers from source, is it possible to add to the dmd_linux page the 64-bit hardware resource requirements for compiling DMD/Phobos from source? Ideally, with the defaults and also with 2.086's -lowmem switch? Maybe an ever-green link, to

Regex driving me nuts

2019-06-17 Thread Bart via Digitalmars-d-learn
Error: static variable `thompsonFactory` cannot be read at compile time, Trying to regex an import file. Also I have a group (...)* and it always fails or matches only one but if I do (...)(...)(...) it matches all 3(fails if more or less of course. ... is the regex). Also when I ignore a