Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-12 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 12 February 2018 at 21:18:01 UTC, Jordi Sayol wrote: El 12/02/18 a les 21:56, Martin Tschierschke via Digitalmars-d-learn ha escrit: I just started to play around with D again on my notebook at home and realized, that I have a broken installation. Even the minimal D "hello world"

Re: rdmd main.d leads to Segmentation fault

2018-02-12 Thread Martin Tschierschke via Digitalmars-d-learn
On Sunday, 4 February 2018 at 11:50:05 UTC, Timoses wrote: On Thursday, 1 February 2018 at 09:01:34 UTC, Kagamin wrote: On Wednesday, 31 January 2018 at 16:59:15 UTC, Timoses wrote: And I would need to do what about it? Sorry, I'm not familiar with assembly code stuff in detail. You can try

Re: No error message in DMD 2.078.2

2018-02-12 Thread psychoticRabbit via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 05:51:05 UTC, Domain wrote: module main; void main () { writeln("Hello"); } Of course, this won't compile, but error message is confused: C:\Git\hello\source>dmd app.d app.d(5): Error: object.Error@(0): Access Violation 0x0065445A

Re: No error message in DMD 2.078.2

2018-02-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, February 13, 2018 05:51:05 Domain via Digitalmars-d-learn wrote: > module main; > > void main () > { > writeln("Hello"); > } > > Of course, this won't compile, but error message is confused: > > C:\Git\hello\source>dmd app.d > app.d(5): Error: > object.Error@(0): Access Violation

No error message in DMD 2.078.2

2018-02-12 Thread Domain via Digitalmars-d-learn
module main; void main () { writeln("Hello"); } Of course, this won't compile, but error message is confused: C:\Git\hello\source>dmd app.d app.d(5): Error: object.Error@(0): Access Violation 0x0065445A 0x006548FE 0x0064DBD3 0x004B0B90 0x004B8A02 0x00594813 0x005797E2

Re: workspace-d dsymbol Visual Code macOS

2018-02-12 Thread Cody Duncan via Digitalmars-d-learn
On Monday, 12 February 2018 at 14:06:49 UTC, Lucia wrote: On Tuesday, 6 February 2018 at 21:25:27 UTC, Joel wrote: [snip] On Tuesday, 6 February 2018 at 20:59:54 UTC, WebFreak001 wrote: can you try git clone https://github.com/Pure-D/workspace-d.git cd workspace-d dub upgrade dub build and

Re: What should I use for concat string into array in loop?

2018-02-12 Thread Seb via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 01:56:45 UTC, H. S. Teoh wrote: On Tue, Feb 13, 2018 at 01:58:42AM +, Marc via Digitalmars-d-learn wrote: appender doesn't support string[] so in such case: Why not? This seems to work: import std.array; import std.stdio; void

Re: What should I use for concat string into array in loop?

2018-02-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 12, 2018 17:56:45 H. S. Teoh via Digitalmars-d-learn wrote: > On Tue, Feb 13, 2018 at 01:58:42AM +, Marc via Digitalmars-d-learn wrote: > > appender doesn't support string[] so in such case: > Why not? This seems to work: > > import std.array; > import std.stdio; >

Re: What should I use for concat string into array in loop?

2018-02-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, February 13, 2018 01:58:42 Marc via Digitalmars-d-learn wrote: > appender doesn't support string[] so in such case: > > string[] output; > > for(...) { > > > >if(...) { > > > > output ~= str; > > > > } > > > > } > > Looking for avoid as many immediate allocations as

Re: What should I use for concat string into array in loop?

2018-02-12 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Feb 13, 2018 at 01:58:42AM +, Marc via Digitalmars-d-learn wrote: > appender doesn't support string[] so in such case: Why not? This seems to work: import std.array; import std.stdio; void main() { auto app = appender!(string[]);

Re: print enum value rather name from enum X : string

2018-02-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, February 13, 2018 01:55:59 Marc via Digitalmars-d-learn wrote: > Thanks for you always well-thought-out answer. I was going to > print it with writefln() calls more than anywhere else so to > avoid casts in all those places, which would make it ugly, I just > used > > > enum foo = "a";

Re: print enum value rather name from enum X : string

2018-02-12 Thread Marc via Digitalmars-d-learn
On Monday, 12 February 2018 at 17:29:47 UTC, Jonathan M Davis wrote: On Monday, February 12, 2018 17:07:50 Marc via Digitalmars-d-learn wrote: [...] If you actually use the enum values anywhere other than with anything from std.conv, std.format, or std.stdio, then when they get converted to

What should I use for concat string into array in loop?

2018-02-12 Thread Marc via Digitalmars-d-learn
appender doesn't support string[] so in such case: string[] output; for(...) { if(...) { output ~= str; } } Looking for avoid as many immediate allocations as possible, what should I use?

Re: inout question

2018-02-12 Thread ketmar via Digitalmars-d-learn
lobo wrote: sure, i meant that you have to modify the second parameter accordingly. ;-) anyway, it's good that you fixed it.

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-12 Thread Jordi Sayol via Digitalmars-d-learn
El 12/02/18 a les 21:56, Martin Tschierschke via Digitalmars-d-learn ha escrit: > I just started to play around with D again on my notebook at home and > realized, > that I have a broken installation. > Even the minimal D "hello world" throws an error at execution. > Speicherzugriffsfehler

Re: inout question

2018-02-12 Thread lobo via Digitalmars-d-learn
On Monday, 12 February 2018 at 05:37:23 UTC, ketmar wrote: Norm wrote: Hi, I'm new to D so can someone explain to me what is happening here? void func(const char* s, char** e) { import core.stdc.stdlib; auto result = strtod(s, e); } Error: function core.stdc.stdlib.strtod

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-12 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 12 February 2018 at 21:08:30 UTC, Seb wrote: On Monday, 12 February 2018 at 20:56:11 UTC, Martin Tschierschke wrote: I just started to play around with D again on my notebook at home and realized, that I have a broken installation. Even the minimal D "hello world" throws an error at

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-12 Thread Seb via Digitalmars-d-learn
On Monday, 12 February 2018 at 20:56:11 UTC, Martin Tschierschke wrote: I just started to play around with D again on my notebook at home and realized, that I have a broken installation. Even the minimal D "hello world" throws an error at execution. Speicherzugriffsfehler (Speicherabzug

dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-12 Thread Martin Tschierschke via Digitalmars-d-learn
I just started to play around with D again on my notebook at home and realized, that I have a broken installation. Even the minimal D "hello world" throws an error at execution. Speicherzugriffsfehler (Speicherabzug geschrieben) aka. core dump Compiling with ldc2 still works. Any hint?

Re: print enum value rather name from enum X : string

2018-02-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 12, 2018 17:07:50 Marc via Digitalmars-d-learn wrote: > If I have an enum like this: > > enum S : string { > > > > foo = "a", > > baa = "b" > > > >} > > when I printed it, to my surprise I get the enum field name > > rather value: > > writefln("%s v%s", S.foo, S.baa); > >

print enum value rather name from enum X : string

2018-02-12 Thread Marc via Digitalmars-d-learn
If I have an enum like this: enum S : string { foo = "a", baa = "b" } when I printed it, to my surprise I get the enum field name rather value: writefln("%s v%s", S.foo, S.baa); output: foo vbaa instead of a vb a cast solves it but without cast everywhere I

Re: How does this error from dub mean "dlang Non-selected Y package is available with version X"?

2018-02-12 Thread Marc via Digitalmars-d-learn
On Monday, 12 February 2018 at 15:51:58 UTC, Marc wrote: the warning is: Non-selected package lnk is available with version ~>0.2.1. What does it mean by *Non-selected* package lnk is available? from what I could tell from the page, it's highest version. But I've tried low versions anyway to

Re: How does this error from dub mean "dlang Non-selected Y package is available with version X"?

2018-02-12 Thread Seb via Digitalmars-d-learn
On Monday, 12 February 2018 at 15:51:58 UTC, Marc wrote: the warning is: Non-selected package lnk is available with version ~>0.2.1. What does it mean by *Non-selected* package lnk is available? from what I could tell from the page, it's highest version. But I've tried low versions anyway to

How does this error from dub mean "dlang Non-selected Y package is available with version X"?

2018-02-12 Thread Marc via Digitalmars-d-learn
the warning is: Non-selected package lnk is available with version ~>0.2.1. What does it mean by *Non-selected* package lnk is available? from what I could tell from the page, it's highest version. But I've tried low versions anyway to see if it Works 0.2.0, 0.1.1 etc and none did. I

Re: opCast cannot implicitly convert a.opCast of type X to Y

2018-02-12 Thread rumbu via Digitalmars-d-learn
On Monday, 12 February 2018 at 02:05:16 UTC, aliak wrote: From spec: Cast expression: "cast ( Type ) UnaryExpression" converts UnaryExpresssion to Type. And https://dlang.org/spec/operatoroverloading.html#cast makes no mention of the return type of opCast. One could think that the return

Re: workspace-d dsymbol Visual Code macOS

2018-02-12 Thread Lucia via Digitalmars-d-learn
On Tuesday, 6 February 2018 at 21:25:27 UTC, Joel wrote: [snip] On Tuesday, 6 February 2018 at 20:59:54 UTC, WebFreak001 wrote: can you try git clone https://github.com/Pure-D/workspace-d.git cd workspace-d dub upgrade dub build and then put the resulting path of the executables in your

Re: typedef behavior

2018-02-12 Thread Alex via Digitalmars-d-learn
On Monday, 12 February 2018 at 11:25:40 UTC, Simen Kjærås wrote: I'm sorry, I was apparently unclear. When I said 'static array' above, I meant 'static member'. Since we've been using arrays in our examples, there could be conflation of ideas there. The fact that you can access (and even

Re: typedef behavior

2018-02-12 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 12 February 2018 at 09:58:13 UTC, Alex wrote: On Monday, 12 February 2018 at 09:37:56 UTC, Simen Kjærås wrote: Not really, since D doesn't have a concept of an address associated with a type, only with instances of it. So when you use a static array, the address is hard-coded.

Re: inout question

2018-02-12 Thread Kagamin via Digitalmars-d-learn
On Monday, 12 February 2018 at 05:33:16 UTC, Norm wrote: I thought inout was supposed to take const or non-const variants, so expected the original const char* s to work. The problem is in argument e: it's mutable, and strtod stores there a part of s, if s is const you end up with const data

Re: typedef behavior

2018-02-12 Thread Alex via Digitalmars-d-learn
On Monday, 12 February 2018 at 09:37:56 UTC, Simen Kjærås wrote: Not really, since D doesn't have a concept of an address associated with a type, only with instances of it. So when you use a static array, the address is hard-coded. -- Simen Ok... so the query on ptr on a static is not

Re: typedef behavior

2018-02-12 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 12 February 2018 at 09:10:52 UTC, Alex wrote: A more extreme example: You have a compiled library, and some .di (header) files. In one of those files is this code: struct S { static int[] arr; void foo(); } Now how should Typedef go about making foo() do the right thing?

Re: typedef behavior

2018-02-12 Thread Alex via Digitalmars-d-learn
On Monday, 12 February 2018 at 08:51:14 UTC, Simen Kjærås wrote: I agree that'd be nice. Sadly, it's not a reasonable expectation. :( :) A more extreme example: You have a compiled library, and some .di (header) files. In one of those files is this code: struct S { static int[] arr;

Re: What does "(this This)" mean in member function templates?

2018-02-12 Thread Nathan S. via Digitalmars-d-learn
On Monday, 12 February 2018 at 08:42:42 UTC, rikki cattermole wrote: https://dlang.org/spec/template.html#TemplateThisParameter Cheers.

Re: typedef behavior

2018-02-12 Thread Simen Kjærås via Digitalmars-d-learn
On Sunday, 11 February 2018 at 19:33:23 UTC, Alex wrote: On Sunday, 11 February 2018 at 15:18:11 UTC, Simen Kjærås wrote: Basically, Typedef looks like this: struct Typedef(T) { T _payload; // Forward method calls, member access, etc, to _payload. } If T looks like this: struct T {

Re: What does "(this This)" mean in member function templates?

2018-02-12 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 12 February 2018 at 08:35:05 UTC, Nathan S. wrote: For example in std.container.rbtree: --- auto equalRange(this This)(Elem e) { auto beg = _firstGreaterEqual(e); alias RangeType = RBRange!(typeof(beg)); if (beg is _end || _less(e, beg.value))

Re: Understanding the AST...

2018-02-12 Thread RazvanN via Digitalmars-d-learn
Hi Joe, I suggest you watch this video which explains how the parse time visitors work: https://www.youtube.com/watch?v=tK072jcoWv4 . On Tuesday, 6 February 2018 at 12:03:06 UTC, joe wrote: Hello everybody! Last week end I found this post (

Re: What does "(this This)" mean in member function templates?

2018-02-12 Thread rikki cattermole via Digitalmars-d-learn
On 12/02/2018 8:35 AM, Nathan S. wrote: For example in std.container.rbtree: ---     auto equalRange(this This)(Elem e)     {     auto beg = _firstGreaterEqual(e);     alias RangeType = RBRange!(typeof(beg));     if (beg is _end || _less(e, beg.value))     // no values

What does "(this This)" mean in member function templates?

2018-02-12 Thread Nathan S. via Digitalmars-d-learn
For example in std.container.rbtree: --- auto equalRange(this This)(Elem e) { auto beg = _firstGreaterEqual(e); alias RangeType = RBRange!(typeof(beg)); if (beg is _end || _less(e, beg.value)) // no values are equal return RangeType(beg,

Re: opUnary with ++ and -- on a struct that has a dynamic array

2018-02-12 Thread aliak via Digitalmars-d-learn
On Monday, 12 February 2018 at 06:16:21 UTC, rumbu wrote: writeln(a++) translates to: A copy = a; a.opUnary!"++"; writeln(copy); copy.a[] and a.a[] are the same reference, you increment a.a[0]/copy.a[0] in opUnary to make this work you will need a postblit constructor: struct A {