Re: Catching Errors

2017-01-21 Thread cym13 via Digitalmars-d
On Friday, 20 January 2017 at 14:22:23 UTC, Adam D. Ruppe wrote: On Friday, 20 January 2017 at 07:50:23 UTC, Jacob Carlborg wrote: That doesn't work well with a unit test framework that want to catch assertions to be able to continue with other tests. I'd suggest writing a new assert handler f

Re: Need a std::numeric_limits::lowest() equivalent

2017-01-21 Thread John Colvin via Digitalmars-d
On Saturday, 21 January 2017 at 00:03:11 UTC, Xavier Bigand wrote: std::numeric_limits::lowest() is describe as "A finite value x such that there is no other finite value y * where y < x." According to what I presume that definition means ("no other finite value" means "no other finit

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread ZombineDev via Digitalmars-d
On Saturday, 21 January 2017 at 02:47:49 UTC, bitwise wrote: When std.experimental.allocator was created, I was under the impression it was meant to be used to make containers. But since allocate() returns void[], casts are required before using that memory, which is unsafe. Is my only option

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread ZombineDev via Digitalmars-d
On Saturday, 21 January 2017 at 09:56:29 UTC, ZombineDev wrote: On Saturday, 21 January 2017 at 02:47:49 UTC, bitwise wrote: When std.experimental.allocator was created, I was under the impression it was meant to be used to make containers. But since allocate() returns void[], casts are require

Re: D for scripting?

2017-01-21 Thread Jacob Carlborg via Digitalmars-d
On 2017-01-21 00:52, 岩倉 澪 wrote: This has already been fixed? Is this fix in a stable release yet? I might not be on the latest version... It's fixed in DMD, _not_ in RDMD. -- /Jacob Carlborg

Re: Interior pointers and fast GC

2017-01-21 Thread Nick Treleaven via Digitalmars-d
On Saturday, 14 January 2017 at 15:30:42 UTC, Rainer Schuetze wrote: In addition, you need to lookup the pool anyway to figure out if the pointer points to non-managed memory (stack, global data, malloc'd memory). Makes me wonder about a GC'd language where each pointer is actually a member o

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Chris Wright via Digitalmars-d
On Sat, 21 Jan 2017 04:01:06 +, bitwise wrote: > On Saturday, 21 January 2017 at 02:47:49 UTC, bitwise wrote: >> [...] > > I can see that 'TypedAllocator' exists, but with a different interface > than the rest of the allocators. Why wouldn't all allocators just have a > common interface? Typ

Re: Need a std::numeric_limits::lowest() equivalent

2017-01-21 Thread Xavier Bigand via Digitalmars-d
Le 21/01/2017 à 10:54, John Colvin a écrit : On Saturday, 21 January 2017 at 00:03:11 UTC, Xavier Bigand wrote: std::numeric_limits::lowest() is describe as "A finite value x such that there is no other finite value y * where y < x." According to what I presume that definition means ("

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Andrei Alexandrescu via Digitalmars-d
On 01/21/2017 01:06 AM, Eugene Wissner wrote: On Saturday, 21 January 2017 at 05:52:49 UTC, bitwise wrote: I hadn't noticed this, but I immediately see two problems: 1) there is no alignedDeallocate() which is needed because aligned allocators usually prepend metadata containing a pointer to th

Re: D for scripting?

2017-01-21 Thread Andrei Alexandrescu via Digitalmars-d
On 01/20/2017 09:15 AM, Russel Winder via Digitalmars-d wrote: On Fri, 2017-01-20 at 07:10 +, Andrei Alexandrescu via Digitalmars- d wrote: […] It would be worth it. I think a fix takes some thinking because if I remember correctly the compiler does not accept files without an extension as

Re: Got the official feedback for my GDC Europe talk

2017-01-21 Thread Andrei Alexandrescu via Digitalmars-d
On 01/20/2017 04:26 AM, Ethan Watson wrote: Landed in my inbox while I was on holiday in Australia (why did I leave it three and a half years between visits jeez never do that again you fool). http://imgur.com/a/I6GrF In summary: * 4.5 out of 5 audience rating. Average was 4.22. * Head count o

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Saturday, 21 January 2017 at 10:15:46 UTC, ZombineDev wrote: On Saturday, 21 January 2017 at 09:56:29 UTC, ZombineDev wrote: On Saturday, 21 January 2017 at 02:47:49 UTC, bitwise wrote: When std.experimental.allocator was created, I was under the impression it was meant to be used to make co

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Saturday, 21 January 2017 at 16:28:16 UTC, Andrei Alexandrescu wrote: alignedAllocate provides access to OS/clib-provided primitives for aligned allocation. Those don't require a special deallocation function, see e.g. http://en.cppreference.com/w/c/memory/aligned_alloc. -- Andrei This mak

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Andrei Alexandrescu via Digitalmars-d
On 01/21/2017 12:14 PM, bitwise wrote: On Saturday, 21 January 2017 at 16:28:16 UTC, Andrei Alexandrescu wrote: alignedAllocate provides access to OS/clib-provided primitives for aligned allocation. Those don't require a special deallocation function, see e.g. http://en.cppreference.com/w/c/memo

Re: Interior pointers and fast GC

2017-01-21 Thread deadalnix via Digitalmars-d
On Saturday, 14 January 2017 at 04:37:01 UTC, Chris Wright wrote: Unfortunately, given an interior pointer, you can't identify the base of its heap object in constant time. 1. Split the heap in chunk of size n being a power of 2, say 4M. Align them 4M. 2. Find the chunk an alloc is part of in

Re: Got the official feedback for my GDC Europe talk

2017-01-21 Thread Ethan Watson via Digitalmars-d
On Saturday, 21 January 2017 at 16:32:36 UTC, Andrei Alexandrescu wrote: Congratulations, that looks like a very good performance! Could you please explain a bit how the Google Slides feature you mentioned works? -- Andrei The core functionality is that a web link is provided that allows peop

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Saturday, 21 January 2017 at 17:26:35 UTC, Andrei Alexandrescu wrote: On 01/21/2017 12:14 PM, bitwise wrote: On Saturday, 21 January 2017 at 16:28:16 UTC, Andrei Alexandrescu wrote: alignedAllocate provides access to OS/clib-provided primitives for aligned allocation. Those don't require a

Re: GSoC 2017 Ideas!

2017-01-21 Thread Craig Dillabaugh via Digitalmars-d
On Sunday, 15 January 2017 at 05:17:10 UTC, Adam D. Ruppe wrote: On Sunday, 15 January 2017 at 04:11:06 UTC, Craig Dillabaugh wrote: I've been trying to find something on this, but haven't yet, but I am not sure if website work would be considered appropriate. The website is still a program,

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Andrei Alexandrescu via Digitalmars-d
On 1/21/17 5:44 PM, bitwise wrote: About alignedMalloc: In C++ for example, I may want to use a vector full some SIMD type: class alignas(16) Vec4 { union { struct { float x, y, z, w; }; __m128 m; }; }; std::vector points = { ... }; In C++ however, 'new' does not respe

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Chris Wright via Digitalmars-d
On Sat, 21 Jan 2017 22:44:49 +, bitwise wrote: > So I use a custom aligned allocator: > > template > class AlignedAllocator { > T* allocate(size_type n) { > return (T*)_aligned_malloc(ALIGN, n * sizeof(T)); > } > }; > > SIMD operations(aligned load and store) can now safel

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Sunday, 22 January 2017 at 00:13:10 UTC, Chris Wright wrote: On Sat, 21 Jan 2017 22:44:49 +, bitwise wrote: So I use a custom aligned allocator: template class AlignedAllocator { T* allocate(size_type n) { return (T*)_aligned_malloc(ALIGN, n * sizeof(T)); } }; SIMD o

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Chris Wright via Digitalmars-d
On Sun, 22 Jan 2017 00:53:45 +, bitwise wrote: > I understand this, but I've given a solid example which supports the > former, and haven't seen a counter example which supports the latter. Because examples that are easy to generate are small and small examples don't have coarse-grained anyth

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Saturday, 21 January 2017 at 23:24:52 UTC, Andrei Alexandrescu wrote: On 1/21/17 5:44 PM, bitwise wrote: About alignedMalloc: In C++ for example, I may want to use a vector full some SIMD type: class alignas(16) Vec4 { union { struct { float x, y, z, w; }; __m128 m;

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Sunday, 22 January 2017 at 01:02:09 UTC, Chris Wright wrote: On Sun, 22 Jan 2017 00:53:45 +, bitwise wrote: I understand this, but I've given a solid example which supports the former, and haven't seen a counter example which supports the latter. Because examples that are easy to gener

Less-than-optimal decimal real literal conversion to x86 extended floats

2017-01-21 Thread pineapple via Digitalmars-d
I'm not sure whether this should be counted as a bug, but I ran into it and thought it deserved mentioning. I've been testing this with DMD on Windows. I wrote this function to support parsing of strings as floating point values: https://github.com/pineapplemachine/mach.d/blob/master/mach/mat

Re: Less-than-optimal decimal real literal conversion to x86 extended floats

2017-01-21 Thread pineapple via Digitalmars-d
On Sunday, 22 January 2017 at 01:54:59 UTC, pineapple wrote: When you write `real x = 0.0005;` x in fact represets a value of about 0.00050032187251995663412884596255025826394. This is a about 3.2 * 10^-23 more than 0.0005. The output of my function in this case was about 0.0

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Saturday, 21 January 2017 at 23:24:52 UTC, Andrei Alexandrescu wrote: Andrei Anyways, design opinions aside, I would be satisfied if an aligned allocator were included in std.allocators that provided aligned heap memory using allocate()/deallocate(). The rest is just details with no pract

Re: Interior pointers and fast GC

2017-01-21 Thread Araq via Digitalmars-d
On Saturday, 21 January 2017 at 17:42:46 UTC, deadalnix wrote: 1. Split the heap in chunk of size n being a power of 2, say 4M. Align them 4M. 2. Find the chunk an alloc is part of in O(1) bu masking the lower bits (22 bits to mask in our 4M case). 3. Have a table of page descriptor in the chu

Re: Interior pointers and fast GC

2017-01-21 Thread Chris Wright via Digitalmars-d
On Sun, 22 Jan 2017 05:02:43 +, Araq wrote: > It's an O(1) that requires a hash table lookup in general because > allocations can exceed the chunk size and so you cannot just mask the > pointer and look at the chunk header because it might not be a chunk > header at all. Know any production GCs

Re: CTFE Status

2017-01-21 Thread Stefan Koch via Digitalmars-d
On Saturday, 21 January 2017 at 05:59:32 UTC, Stefan Koch wrote: On Friday, 20 January 2017 at 19:08:28 UTC, Stefan Koch wrote: Druntime and phobos broke, the reason being that, I did test against an outdated version of druntime/phobos. I am working on getting them to compile again. Adding feat

Re: Interior pointers and fast GC

2017-01-21 Thread Araq via Digitalmars-d
On Sunday, 22 January 2017 at 06:28:35 UTC, Chris Wright wrote: On Sun, 22 Jan 2017 05:02:43 +, Araq wrote: It's an O(1) that requires a hash table lookup in general because allocations can exceed the chunk size and so you cannot just mask the pointer and look at the chunk header because i