Re: segfault on gc.impl.conservative.gc.Gcx.smallAlloc

2017-09-25 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 25 September 2017 at 21:34:40 UTC, Mengu wrote: delete fileContents; This looks suspicious - it is a slice of the memory-mapped file, not memory on the GC-managed heap, so "delete" is inapplicable to it. The GC ought to throw an exception when attempting to delete things not o

segfault on gc.impl.conservative.gc.Gcx.smallAlloc

2017-09-25 Thread Mengu via Digitalmars-d-learn
hi all this following code block [0] is exiting with "terminated by signal SIGBUS (Misaligned address error)" error. it processes like 200K rows and then fails. any ideas? void getHotels() { import std.parallelism : taskPool; import std.functional : partial; auto sunHotels = n

Re: Cannot make LDC use LTO when called via DUB

2017-09-25 Thread Nordlöw via Digitalmars-d-learn
On Monday, 25 September 2017 at 07:47:28 UTC, Sebastiaan Koppe wrote: Maybe you are looking for dflags "..." platform="..." Ahh, you're right. Thanks!

Re: is it bug?

2017-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/17 2:03 PM, drug wrote: https://run.dlang.io/is/pZwsoX As I can see std.format.formatElement thinks Nullable!Foo is not null, try to get its value but it is null so fail? OK, so I was confused quite a bit. There are 2 problems. One is a bug, one is not. First up, the non-bug: You w

Re: is it bug?

2017-09-25 Thread drug via Digitalmars-d-learn
https://run.dlang.io/is/pZwsoX As I can see std.format.formatElement thinks Nullable!Foo is not null, try to get its value but it is null so fail?

Re: is it bug?

2017-09-25 Thread drug via Digitalmars-d-learn
25.09.2017 20:47, Adam D. Ruppe пишет: On Monday, 25 September 2017 at 17:44:54 UTC, drug wrote: https://run.dlang.io/is/uk0CMC You didn't initialize it. It's not null, but it also isn't a valid character. but exception is caused by using `get` on null Foo instance, not by invalid character

Re: is it bug?

2017-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/17 1:44 PM, drug wrote: https://run.dlang.io/is/uk0CMC Definitely a bug. -Steve

Re: is it bug?

2017-09-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 25 September 2017 at 17:44:54 UTC, drug wrote: https://run.dlang.io/is/uk0CMC You didn't initialize it. It's not null, but it also isn't a valid character. D initializes chars to 0xff, which is an invalid char. Perhaps the Nullable one should have initialized to null but otherw

is it bug?

2017-09-25 Thread drug via Digitalmars-d-learn
https://run.dlang.io/is/uk0CMC

Re: Real beginner traits question

2017-09-25 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Sep 25, 2017 at 03:41:14PM +, WhatMeWorry via Digitalmars-d-learn wrote: > On Monday, 25 September 2017 at 06:07:58 UTC, H. S. Teoh wrote: > > On Mon, Sep 25, 2017 at 05:28:13AM +, WhatMeForget via > > Digitalmars-d-learn wrote: > > > [...] > > > > You're not the only one. I star

Re: Real beginner traits question

2017-09-25 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 25 September 2017 at 06:07:58 UTC, H. S. Teoh wrote: On Mon, Sep 25, 2017 at 05:28:13AM +, WhatMeForget via Digitalmars-d-learn wrote: [...] You're not the only one. I stared at this same piece of documentation for a long time before I figured out what it meant. This is anoth

Re: detect implicitly convertible typeid's?

2017-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/17 10:43 AM, bitwise wrote: On Monday, 25 September 2017 at 13:20:03 UTC, Steven Schveighoffer wrote: On 9/23/17 11:52 AM, bitwise wrote: Is it possible to tell if two objects represented by TypeInfo's are convertible to each other? Basically, is there a built in way to do this? int

Re: Is it possible to avoid call to destructor for structs?

2017-09-25 Thread bitwise via Digitalmars-d-learn
On Monday, 25 September 2017 at 08:39:26 UTC, Adrian Matoga wrote: [...] You shouldn't store the pointer to barBuffer inside Foo. The language allows moving the structure around with a simple memcpy, so _bar is likely to point into garbage soon after it's assigned. Good point - but it's a m

Re: detect implicitly convertible typeid's?

2017-09-25 Thread bitwise via Digitalmars-d-learn
On Monday, 25 September 2017 at 13:20:03 UTC, Steven Schveighoffer wrote: On 9/23/17 11:52 AM, bitwise wrote: Is it possible to tell if two objects represented by TypeInfo's are convertible to each other? Basically, is there a built in way to do this? int x; long y; assert(typeid(x).isImplici

Re: Is this defined behaviour in D?

2017-09-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, September 25, 2017 13:06:56 John Burton via Digitalmars-d-learn wrote: > If I have a int* pointer for example, that points to the start of > an int array and step through the array until I get the value > 123, is it defined in D what happens if you step off the end of > the array? > > W

Re: Cannot make LDC use LTO when called via DUB

2017-09-25 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-09-25 09:47, Sebastiaan Koppe wrote: I didn't know dflags-* was a thing, and I can't find it in docs either. That's how it works in the JSON package description file. -- /Jacob Carlborg

Re: Is this defined behaviour in D?

2017-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/17 9:06 AM, John Burton wrote: If I have a int* pointer for example, that points to the start of an int array and step through the array until I get the value 123, is it defined in D what happens if you step off the end of the array? What I might expect to happen is for the code to jus

Re: detect implicitly convertible typeid's?

2017-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/23/17 11:52 AM, bitwise wrote: Is it possible to tell if two objects represented by TypeInfo's are convertible to each other? Basically, is there a built in way to do this? int x; long y; assert(typeid(x).isImplicitlyConvertibleTo(typeid(y)); I would say no. There isn't any function/dat

Is this defined behaviour in D?

2017-09-25 Thread John Burton via Digitalmars-d-learn
If I have a int* pointer for example, that points to the start of an int array and step through the array until I get the value 123, is it defined in D what happens if you step off the end of the array? What I might expect to happen is for the code to just keep stepping through sequential mem

Re: Is it possible to avoid call to destructor for structs?

2017-09-25 Thread Adrian Matoga via Digitalmars-d-learn
On Sunday, 24 September 2017 at 19:52:52 UTC, bitwise wrote: On Sunday, 24 September 2017 at 17:11:26 UTC, Haridas wrote: In the following code, Bar is an element of struct Foo. Is there a way to avoid a call to ~Bar when ~Foo is getting executed? Don't construct it to begin with. struct B

Re: Real beginner traits question

2017-09-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, September 25, 2017 05:28:13 WhatMeForget via Digitalmars-d-learn wrote: > This is taken exactly from the traits documentation. > > > > 25 Traits > > 25.21 identifier > > Takes one argument, a symbol. Returns the identifier for that > symb

Re: Cannot make LDC use LTO when called via DUB

2017-09-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
Neither dflags-dmd "-xxx" dflags-posix-dmd "-xxx" dflags-linux-dmd "-xxx" has any effect on my build (in dub.sdl). I didn't know dflags-* was a thing, and I can't find it in docs either. Maybe you are looking for dflags "..." platform="..."