Re: Program exited with code -11

2015-06-23 Thread Baz via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 06:50:28 UTC, Charles Hawkins wrote: On Tuesday, 23 June 2015 at 03:31:37 UTC, weaselcat wrote: On Tuesday, 23 June 2015 at 03:29:14 UTC, Charles Hawkins wrote: Thanks, Adam. I'm coming from OCaml and haven't seen a seg fault in years. Didn't recognize it. :D Hope

Re: Program exited with code -11

2015-06-23 Thread Charles Hawkins via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 07:25:05 UTC, Baz wrote: On Tuesday, 23 June 2015 at 06:50:28 UTC, Charles Hawkins wrote: On Tuesday, 23 June 2015 at 03:31:37 UTC, weaselcat wrote: On Tuesday, 23 June 2015 at 03:29:14 UTC, Charles Hawkins wrote: Thanks, Adam. I'm coming from OCaml and haven't seen

Re: Program exited with code -11

2015-06-23 Thread Charles Hawkins via Digitalmars-d-learn
Ok, I think I've answered my own question. dub -v tells me what I need to know. Looks like I need to do a separate compile & link, make file like, just like the old days, or have a very complicated command line. However, if there is a simple way to do the above, which it seems there should b

Re: Program exited with code -11

2015-06-23 Thread Baz via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 07:25:05 UTC, Baz wrote: in dmd you have to pass - the .lib/.a files a source I meant "as source", actually. you pass the .lib or .a file without switch as if it's a main source.

Re: Program exited with code -11

2015-06-23 Thread Charles Hawkins via Digitalmars-d-learn
Try to compile with either ldc or gdc and the -g flag, it should give you a backtrace. dmd seems to not like linux wrt backtraces. ...I haven't had any success in compiling with anything but dub. gdc, dmd, rdmd always give me "module mylib is in file 'mylib.d' which cannot be read" on my "im

Re: Casting MapResult

2015-06-23 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 01:27:21 UTC, jmh530 wrote: On Tuesday, 16 June 2015 at 16:37:35 UTC, John Colvin wrote: If you want really fast exponentiation of an array though, you want to use SIMD. Something like http://www.yeppp.info would be easy to use from D. I've been looking into SIMD a

Re: Program exited with code -11

2015-06-23 Thread anonymous via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 07:57:26 UTC, Charles Hawkins wrote: Sigh. I'm probably doing something stupid. I tried full paths: dmd -I+/home/charles/projects/d/mylib/source/mylib/ myprog.d What's that plus sign doing there? Looks wrong. /home/charles/projects/d/mylib/build/libmylib.a Same

Re: fast way to insert element at index 0

2015-06-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/23/15 1:51 AM, jkpl wrote: On Tuesday, 23 June 2015 at 05:16:23 UTC, Assembly wrote: What's a fast way to insert an element at index 0 of array? now that the code is working I want to clean this: void push(T val) { T[] t = new T[buffer.length + 1]; t[0] = val; t

Re: fast way to insert element at index 0

2015-06-23 Thread Baz via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 11:22:31 UTC, Steven Schveighoffer wrote: On 6/23/15 1:51 AM, jkpl wrote: On Tuesday, 23 June 2015 at 05:16:23 UTC, Assembly wrote: [...] * Option 1/ if most of the time you have to insert at the beginning, then start reading from the end and append to the end, s

Re: Program exited with code -11

2015-06-23 Thread Charles Hawkins via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 11:18:07 UTC, anonymous wrote: On Tuesday, 23 June 2015 at 07:57:26 UTC, Charles Hawkins wrote: Sigh. I'm probably doing something stupid. I tried full paths: dmd -I+/home/charles/projects/d/mylib/source/mylib/ myprog.d What's that plus sign doing there? Looks w

Re: fast way to insert element at index 0

2015-06-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/23/15 8:12 AM, Baz wrote: On Tuesday, 23 June 2015 at 11:22:31 UTC, Steven Schveighoffer wrote: On 6/23/15 1:51 AM, jkpl wrote: On Tuesday, 23 June 2015 at 05:16:23 UTC, Assembly wrote: [...] * Option 1/ if most of the time you have to insert at the beginning, then start reading from t

Re: fast way to insert element at index 0

2015-06-23 Thread Baz via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 13:29:41 UTC, Steven Schveighoffer wrote: On 6/23/15 8:12 AM, Baz wrote: On Tuesday, 23 June 2015 at 11:22:31 UTC, Steven Schveighoffer wrote: [...] according to the C library, memmove handle overlapps, you mismatch with memcpy which does not. The above is not

Re: Casting MapResult

2015-06-23 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 10:50:51 UTC, John Colvin wrote: If I remember correctly, core.simd should work with every compiler on every supported OS. What did you try that didn't work? I figured out the issue! You have to compile using the -m64 flag to get it to work on Windows (this works

Re: fast way to insert element at index 0

2015-06-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/23/15 10:20 AM, Baz wrote: On Tuesday, 23 June 2015 at 13:29:41 UTC, Steven Schveighoffer wrote: On 6/23/15 8:12 AM, Baz wrote: On Tuesday, 23 June 2015 at 11:22:31 UTC, Steven Schveighoffer wrote: [...] according to the C library, memmove handle overlapps, you mismatch with memcpy whic

Re: core.exception.InvalidMemoryOperationError@(0) on File Reading.

2015-06-23 Thread David DeWitt via Digitalmars-d-learn
On Monday, 22 June 2015 at 20:30:40 UTC, David DeWitt wrote: I am getting an core.exception.InvalidMemoryOperationError@(0) auto recs = f // Open for reading .byLineCopy(); .array; //Here is where is appears to be happening. [...]

cannot use UDA with same name as one of field's name

2015-06-23 Thread sigod via Digitalmars-d-learn
Hi. I have few questions about this piece of code. ``` import vibe.data.serialization; struct User { @name("_id") int id; // Error: function expected before (), not name of type string string name; } ``` Is it even proper compiler behavior? Is there any way to bypass it without usin

Re: cannot use UDA with same name as one of field's name

2015-06-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/23/15 4:53 PM, sigod wrote: Hi. I have few questions about this piece of code. ``` import vibe.data.serialization; struct User { @name("_id") int id; // Error: function expected before (), not name of type string string name; } ``` Is it even proper compiler behavior? Yes, nam

Re: cannot use UDA with same name as one of field's name

2015-06-23 Thread sigod via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 22:10:43 UTC, Steven Schveighoffer wrote: You can use @full.path.name ``` Error: unexpected ( in declarator Error: basic type expected, not "_id" Error: found '"_id"' when expecting ')' Error: no identifier for declarator .data.serialization.name(int) Error: semicolo

Re: cannot use UDA with same name as one of field's name

2015-06-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/23/15 7:00 PM, sigod wrote: On Tuesday, 23 June 2015 at 22:10:43 UTC, Steven Schveighoffer wrote: You can use @full.path.name ``` Error: unexpected ( in declarator Error: basic type expected, not "_id" Error: found '"_id"' when expecting ')' Error: no identifier for declarator .data.seria

Re: cannot use UDA with same name as one of field's name

2015-06-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 23:14:13 UTC, Steven Schveighoffer wrote: I'm not completely sure on the syntax, try adding some parens. Yeah, I'm pretty sure it needs to be @(full.name.here) void foo()

Re: cannot use UDA with same name as one of field's name

2015-06-23 Thread sigod via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 23:52:52 UTC, Adam D. Ruppe wrote: On Tuesday, 23 June 2015 at 23:14:13 UTC, Steven Schveighoffer wrote: I'm not completely sure on the syntax, try adding some parens. Yeah, I'm pretty sure it needs to be @(full.name.here) void foo() Yep, something like this work

Re: Program exited with code -11

2015-06-23 Thread weaselcat via Digitalmars-d-learn
On Tuesday, 23 June 2015 at 06:50:28 UTC, Charles Hawkins wrote: On Tuesday, 23 June 2015 at 03:31:37 UTC, weaselcat wrote: On Tuesday, 23 June 2015 at 03:29:14 UTC, Charles Hawkins wrote: [...] Try to compile with either ldc or gdc and the -g flag, it should give you a backtrace. dmd seems