[Issue 7953] DMD Error: variable r used before set when compiling with -O

2016-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7953

--- Comment #7 from Walter Bright  ---
(In reply to SomeDude from comment #3)
> but I can't reproduce the error message, so maybe I've overlooked something.
> However, interestingly, this compiles with -O flag and crashes the compiler
> without.
> 
> PS E:\DigitalMars\dmd2\samples> rdmd bug.d
> Internal error: ..\ztc\cg87.c 1699

This works without error in the current compiler.

--


[Issue 7953] DMD Error: variable r used before set when compiling with -O

2016-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7953

Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution|--- |INVALID

--- Comment #6 from Walter Bright  ---
float4 r;
...
res.ptr[4] = r.ptr[4]; // Error: variable r used before set

The error here is that there are only 4 entries in float4, and you're indexing
the 5th one. If the function is marked @safe, it won't compile.

Not a compiler bug.

--


Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread Andrei Alexandrescu via Digitalmars-d

On 4/24/16 7:00 PM, Temtaime wrote:

On Sunday, 24 April 2016 at 21:45:32 UTC, Walter Bright wrote:

On 4/24/2016 8:33 AM, Andrei Alexandrescu wrote:

On 04/24/2016 02:57 AM, deadalnix wrote:

On Saturday, 23 April 2016 at 15:29:08 UTC, Andrei Alexandrescu wrote:

Yah, that's the canonical. I forgot why I chose (x & -x) > (x - 1)
over it.


I'm not sure why do you test against x - 1 when you could test for
equality. Not only it looks like it is going to require an extra
computation (x - 1) but also it doesn't work for 0.


So if you do (x & -x) == x that returns 1 for x == 0. For many
applications you
want to yield 0. So you test for (x & -x) > (x - 1) such that for x
== 0 the
right hand side is a large number. -- Andrei


This sort of stuff should go on wiki.dlang.org page!


Please no cmp.


Why? -- Andrei



Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread Andrei Alexandrescu via Digitalmars-d

On 4/24/16 9:17 PM, Xinok wrote:

I modified David's solution a bit to (hopefully) eliminate the branch:
bool powerOf2(uint x){ return !x ^ !(x & (x - 1)); }

  <_D4test8powerOf2FkZb>:
0:   50  push   %rax
1:   53  push   %rbx
2:   48 89 famov%rdi,%rdx
5:   85 d2   test   %edx,%edx
7:   0f 94 c0sete   %al
a:   8d 8a ff ff ff ff   lea-0x1(%rdx),%ecx
   10:   85 ca   test   %ecx,%edx
   12:   0f 94 c3sete   %bl
   15:   32 c3   xor%bl,%al
   17:   5b  pop%rbx
   18:   59  pop%rcx
   19:   c3  retq
   1a:   66 0f 1f 44 00 00   nopw   0x0(%rax,%rax,1)

The branches are gone but I'm really not sure if this is better or worse.


With gdc https://godbolt.org/g/jcU4np isPow2B is the winner (shortest 
code, simplest instructions). -- Andrei


Re: Why are tests restarting in Github?

2016-04-24 Thread Daniel Murphy via Digitalmars-d

On 25/04/2016 5:44 AM, ag0aep6g wrote:

On 24.04.2016 21:26, tcak wrote:

There are 10 test. Some of them gets completed. And then, I look at it
again, tests have restarted, and less number of tests are passed at that
point.

1. What is the reason of restarts?


Something else has been pulled. That changes the code that's being
tested, so all tests need to restarted.


2. What is reason of long waiting time? Sometimes number of passed tests
stay there 2-3 days.


The pull request is probably not a priority for the auto-tester. Pull
requests that have been marked for auto-merging have priority over
others. I'm not sure, but the auto-tester may also prioritize requests
with recent activity over older ones.


Yes, if you rebase and force-push your pull will be put at the top of 
the list.


[Issue 15945] sizeof on an invalid type seems to compile.

2016-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15945

Marco Leise  changed:

   What|Removed |Added

 CC||marco.le...@gmx.de

--- Comment #1 from Marco Leise  ---
You are not indexing T, you are creating a static array of length 0, hence why
it returns 0 for the size. Try T.init[0] instead to use an instance of T.

--


Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread Xinok via Digitalmars-d

On Sunday, 24 April 2016 at 23:17:53 UTC, David Nadlinger wrote:

On Sunday, 24 April 2016 at 23:00:56 UTC, Temtaime wrote:

Please no cmp.
Just
bool isPowerOf2(uint x) { return x && !(x & (x - 1)); }


You do realise that this will (typically) emit a branch?

 — David


I compiled using dmd -O and looked at the disassembly using 
objdump -D and there are indeed a couple branches in the 
disassembly:


 <_D4test8powerOf2FkZk>:
   0:   50  push   %rax
   1:   48 89 f9mov%rdi,%rcx
   4:   85 c9   test   %ecx,%ecx
   6:   74 0a   je 12 
<_D4test8powerOf2FkZk+0x12>

   8:   8d 81 ff ff ff ff   lea-0x1(%rcx),%eax
   e:   85 c1   test   %eax,%ecx
  10:   74 04   je 16 
<_D4test8powerOf2FkZk+0x16>

  12:   31 c0   xor%eax,%eax
  14:   eb 05   jmp1b 
<_D4test8powerOf2FkZk+0x1b>

  16:   b8 01 00 00 00  mov$0x1,%eax
  1b:   59  pop%rcx
  1c:   c3  retq
  1d:   0f 1f 00nopl   (%rax)


I modified David's solution a bit to (hopefully) eliminate the 
branch:

bool powerOf2(uint x){ return !x ^ !(x & (x - 1)); }

 <_D4test8powerOf2FkZb>:
   0:   50  push   %rax
   1:   53  push   %rbx
   2:   48 89 famov%rdi,%rdx
   5:   85 d2   test   %edx,%edx
   7:   0f 94 c0sete   %al
   a:   8d 8a ff ff ff ff   lea-0x1(%rdx),%ecx
  10:   85 ca   test   %ecx,%edx
  12:   0f 94 c3sete   %bl
  15:   32 c3   xor%bl,%al
  17:   5b  pop%rbx
  18:   59  pop%rcx
  19:   c3  retq
  1a:   66 0f 1f 44 00 00   nopw   0x0(%rax,%rax,1)

The branches are gone but I'm really not sure if this is better 
or worse.


Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread Xinok via Digitalmars-d

On Monday, 25 April 2016 at 01:17:48 UTC, Xinok wrote:

...


Sorry, didn't mean to say David's solution. Too many edits. >_<


Re: Why are tests restarting in Github?

2016-04-24 Thread Basile B. via Digitalmars-d

On Sunday, 24 April 2016 at 19:26:43 UTC, tcak wrote:
2. What is reason of long waiting time? Sometimes number of 
passed tests stay there 2-3 days.


There's a windows tester (win-farm-1) that takes 1 hour to 
complete each single test while most of the other testers usually 
take 10 to 20 minutes. On high activity period it's almost 
impossible to get an old PR fully tested. Each time someone 
amends or fixes-up something the slow machines take the new 
stuffs before.


For example look at this one:
https://auto-tester.puremagic.com/pull-history.ghtml?projectid=1=3=4204

win_32_64 (win-farm-1) has only run **once** while FreeBSD_32 has 
run **21 times** !!


Re: DlangUI translations

2016-04-24 Thread stunaep via Digitalmars-d-learn

On Sunday, 24 April 2016 at 04:49:36 UTC, thedeemon wrote:

On Saturday, 23 April 2016 at 15:44:22 UTC, stunaep wrote:
I am wondering how to use other languages and how to NOT use 
other languages.


Did you see example1 from examples folder in dlangui? It has 
two languages and allows switching at runtime via menu.


But I don't know how to change the language for ui components 
such as buttons and text. And the most important thing is 
removing "UNTRANSLATED: " from items in my list.


Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread David Nadlinger via Digitalmars-d

On Sunday, 24 April 2016 at 23:00:56 UTC, Temtaime wrote:

Please no cmp.
Just
bool isPowerOf2(uint x) { return x && !(x & (x - 1)); }


You do realise that this will (typically) emit a branch?

 — David


Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread Temtaime via Digitalmars-d

On Sunday, 24 April 2016 at 21:45:32 UTC, Walter Bright wrote:

On 4/24/2016 8:33 AM, Andrei Alexandrescu wrote:

On 04/24/2016 02:57 AM, deadalnix wrote:
On Saturday, 23 April 2016 at 15:29:08 UTC, Andrei 
Alexandrescu wrote:
Yah, that's the canonical. I forgot why I chose (x & -x) > 
(x - 1)

over it.


I'm not sure why do you test against x - 1 when you could 
test for
equality. Not only it looks like it is going to require an 
extra

computation (x - 1) but also it doesn't work for 0.


So if you do (x & -x) == x that returns 1 for x == 0. For many 
applications you
want to yield 0. So you test for (x & -x) > (x - 1) such that 
for x == 0 the

right hand side is a large number. -- Andrei


This sort of stuff should go on wiki.dlang.org page!


Please no cmp.
Just
bool isPowerOf2(uint x) { return x && !(x & (x - 1)); }


Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread Walter Bright via Digitalmars-d

On 4/24/2016 8:33 AM, Andrei Alexandrescu wrote:

On 04/24/2016 02:57 AM, deadalnix wrote:

On Saturday, 23 April 2016 at 15:29:08 UTC, Andrei Alexandrescu wrote:

Yah, that's the canonical. I forgot why I chose (x & -x) > (x - 1)
over it.


I'm not sure why do you test against x - 1 when you could test for
equality. Not only it looks like it is going to require an extra
computation (x - 1) but also it doesn't work for 0.


So if you do (x & -x) == x that returns 1 for x == 0. For many applications you
want to yield 0. So you test for (x & -x) > (x - 1) such that for x == 0 the
right hand side is a large number. -- Andrei


This sort of stuff should go on wiki.dlang.org page!


Re: Directions to Ibis Hotel in Berlin from Tegel Airport

2016-04-24 Thread Walter Bright via Digitalmars-d

On 4/24/2016 10:56 AM, Iain Buclaw via Digitalmars-d wrote:

On 24 April 2016 at 10:44, Walter Bright via Digitalmars-d
 wrote:

The hotel emailed them to me, I presume they know what they're doing :-) so
I thought I'd share:

Bus 109 to Jakob-Kaiser-Platz
Subway U 7 in the direction of Rudow to Grenzallee
Cross the street at the traffic light and turn left. The next street on the
right is Jahnstraße.
On the left side you will find our hotel.


Conveniently, also the directions to Berghain.  :-)



What's the best way to buy a ticket? On the bus itself, or is there a kiosk? 
Credit card?


Re: Official dub packages for Debian and Ubuntu

2016-04-24 Thread Matthias Klumpp via Digitalmars-d-announce
On Thursday, 21 April 2016 at 22:00:11 UTC, Joseph Rushton 
Wakeling wrote:
On Thursday, 21 April 2016 at 20:13:07 UTC, Joseph Rushton 
Wakeling wrote:
On Monday, 18 April 2016 at 21:54:43 UTC, Matthias Klumpp 
wrote:
Unfortunately it FTBFSes... Hopefully we can get the patch 
for that in as well: 
https://github.com/ldc-developers/ldc/commit/cb709bfc0a0a3ee8a730c0a99fa53198b6d75364.patch

(I'm working on that)


I see you succeeded -- many thanks again :-)


Might amuse you to know: I just did a fresh 16.04 install this 
evening, and ldc was the first package I installed, followed by 
dub ;-)


Both seem to work like a charm.  And besides the packages, 
thanks for the updated new ldc description!


Thanks! :-) The updated ldc description wasn't me though, that 
was Konstantinos with the 1:0.17.1-1 release ;-)




Re: Why are tests restarting in Github?

2016-04-24 Thread ag0aep6g via Digitalmars-d

On 24.04.2016 21:26, tcak wrote:

There are 10 test. Some of them gets completed. And then, I look at it
again, tests have restarted, and less number of tests are passed at that
point.

1. What is the reason of restarts?


Something else has been pulled. That changes the code that's being 
tested, so all tests need to restarted.



2. What is reason of long waiting time? Sometimes number of passed tests
stay there 2-3 days.


The pull request is probably not a priority for the auto-tester. Pull 
requests that have been marked for auto-merging have priority over 
others. I'm not sure, but the auto-tester may also prioritize requests 
with recent activity over older ones.


Why are tests restarting in Github?

2016-04-24 Thread tcak via Digitalmars-d
There are 10 test. Some of them gets completed. And then, I look 
at it again, tests have restarted, and less number of tests are 
passed at that point.


1. What is the reason of restarts?

2. What is reason of long waiting time? Sometimes number of 
passed tests stay there 2-3 days.


Re: Directions to Ibis Hotel in Berlin from Tegel Airport

2016-04-24 Thread Iain Buclaw via Digitalmars-d
On 24 April 2016 at 10:44, Walter Bright via Digitalmars-d
 wrote:
> The hotel emailed them to me, I presume they know what they're doing :-) so
> I thought I'd share:
>
> Bus 109 to Jakob-Kaiser-Platz
> Subway U 7 in the direction of Rudow to Grenzallee
> Cross the street at the traffic light and turn left. The next street on the
> right is Jahnstraße.
> On the left side you will find our hotel.

Conveniently, also the directions to Berghain.  :-)



Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread Andrei Alexandrescu via Digitalmars-d

On 04/24/2016 02:57 AM, deadalnix wrote:

On Saturday, 23 April 2016 at 15:29:08 UTC, Andrei Alexandrescu wrote:

Yah, that's the canonical. I forgot why I chose (x & -x) > (x - 1)
over it.


I'm not sure why do you test against x - 1 when you could test for
equality. Not only it looks like it is going to require an extra
computation (x - 1) but also it doesn't work for 0.


So if you do (x & -x) == x that returns 1 for x == 0. For many 
applications you want to yield 0. So you test for (x & -x) > (x - 1) 
such that for x == 0 the right hand side is a large number. -- Andrei


Re: Why I can't pass to datetime.benchmark function with parameters?

2016-04-24 Thread David Nadlinger via Digitalmars-d-learn

On Saturday, 23 April 2016 at 18:52:30 UTC, Suliman wrote:

My error. I mean it should be:
auto r = benchmark!(foo(4))(1);

But thanks for answer!


This would use the result of foo(4) as the template parameter. 
Use e.g. { foo(4); } instead (a function that calls foo with the 
desired argument).


 - David


Re: Line spacing for '///ditto' on the website

2016-04-24 Thread Andrei Alexandrescu via Digitalmars-d

On 04/24/2016 08:28 AM, Joseph Rushton Wakeling wrote:

The use of hardcoded  tags in ddoc output is a bit odd -- surely it
would be better to encode the list of symbols as entries in an
unnumbered list, and use CSS to style its layout as wished?


Great idea - could you please work on a PR to introduce that? -- Andrei


[Issue 15907] Unjustified "is not visible from module" deprecation warning when using getMember trait

2016-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15907

Philpax  changed:

   What|Removed |Added

 CC||m...@philpax.me

--- Comment #2 from Philpax  ---
Just ran into this issue as well - are there any "decent" workarounds? All I've
found is manually excluding the problem objects before using getMember, but
that's not really a scalable fix.

--


Re: Distributor's whishlist and questions for D

2016-04-24 Thread Iain Buclaw via Digitalmars-d
On 23 April 2016 at 21:35, Jacob Carlborg via Digitalmars-d
 wrote:
> On 2016-04-21 03:01, Matthias Klumpp wrote:
>
>> ## How complete are the free compilers?
>> This is an important question, because we would need to know whether we
>> can expect D code to be compiled by any compiler, or whether there are
>> tradeoffs that must be made.
>> This question is asking manly how complete LDC and GDC are compared to
>> each other, but also whether both are implementing the D2 specification
>> completely.
>
>
> GDC does not completely implement the D2 specification. Not sure about LDC.
> GDC is several versions behind DMD. LDC are much closer to DMD these days.
> Perhaps only one version behind.
>

To be fair, DMD doesn't implement the D2 specification either.


Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread Iain Buclaw via Digitalmars-d
On 23 April 2016 at 15:56, Andrei Alexandrescu via Digitalmars-d
 wrote:
> On 4/23/16 9:54 AM, Andrei Alexandrescu wrote:
>>
>> On 4/23/16 9:06 AM, Vladimir Panteleev wrote:
>>>
>>> On Saturday, 23 April 2016 at 13:04:00 UTC, Nordlöw wrote:

 Wanted: CT-trait and run-time predicate for checking whether its
 single integer parameter is an exact power of two.
>>>
>>>
>>> popcnt(x) <= 1 ?
>>
>>
>> Would be interesting to see how it compares to the handwritten version
>> on different machines. popcnt has a reputation of being slow in older
>> CPUs, in recent ones it has a latency of 3 cycles and a throughput of 1
>> cycle. -- Andrei
>
>
> Oh, and the bummer is that on gdc it's a function call:
> https://godbolt.org/g/dEYCcG -- Andrei
>

That can easily be changed. ;-)



Re: Will the GC scan this pointer?

2016-04-24 Thread safety0ff via Digitalmars-d-learn

On Sunday, 24 April 2016 at 11:03:11 UTC, Lass Safin wrote:


So the question is: Will the GC scan ptr? As you can see, it is 
a write-only pointer, so reading from it will cause undefined 
behavior (such as return data which looks like a pointer to 
data..), and can potentially be reallly slow.


The GC will see that ptr doesn't point to memory managed by the 
GC and move on.


Do I have to mark it with NO_SCAN each time I call 
glMapNamedBufferRange?


No, calling setAttr on memory not managed by the GC will do 
nothing.


Re: Line spacing for '///ditto' on the website

2016-04-24 Thread Joseph Rushton Wakeling via Digitalmars-d
On Saturday, 23 April 2016 at 19:53:38 UTC, Andrei Alexandrescu 
wrote:

On 04/23/2016 03:50 PM, ag0aep6g wrote:

On 23.04.2016 21:43, Andrei Alexandrescu wrote:

http://dlang.org/phobos/std_experimental_allocator_building_blocks_affix_allocator.html#.AffixAllocator.goodAllocSize

Looks like almost a full line in between.


It is a full line ().


Should we use a single ? -- Andrei


The use of hardcoded  tags in ddoc output is a bit odd -- 
surely it would be better to encode the list of symbols as 
entries in an unnumbered list, and use CSS to style its layout as 
wished?


Re: Will the GC scan this pointer?

2016-04-24 Thread ag0aep6g via Digitalmars-d-learn

On 24.04.2016 13:03, Lass Safin wrote:

// Omitting the required imports.

void[] ptr;

void main() {
 uint buffer;
 glCreateBuffers(1, );
 // Filling the buffer with data and such...
 ptr = glMapNamedBufferRange(buffer, 0, 512, GL_MAP_WRITE_BIT |
GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT)[0 .. 512];
}

So the question is: Will the GC scan ptr?

[...]

Do I have to mark it with NO_SCAN each time I call glMapNamedBufferRange?


I don't think so. The GC generally doesn't care about heap memory that's 
not been allocated through it. As I understand it, you'd have to state 
explicitly that that memory should be scanned.


Re: GSoC 2016 - A replacement of std.xml for the Phobos standard library

2016-04-24 Thread Chris via Digitalmars-d
On Saturday, 23 April 2016 at 08:30:32 UTC, Lodovico Giaretta 
wrote:

Hi,

I'm Lodovico Giaretta and I've been selected by the D 
Foundation for GSoC 2016.


First of all, I'd like to thank the D Foundation for this 
fantastic opportunity.
In particular, I'd like to thank Craig Dillabaugh and Robert 
Schadek for their patience in helping me from my first contacts 
till now.
I'll do my best to implement my proposal and make this 
experience really unique.


My proposal is available online: 
https://drive.google.com/file/d/0B2_hnTCdWtH-eEplQ3hZdnY2Wlk/view?usp=sharing


Also, while writing the proposal, I started implementing some 
small components. You can find my efforts here: 
https://github.com/lodo1995/experimental.xml

I expect that I'll restart updating it in a couple of days.

This is my first experience at GSoC and also my first 
collaboration with a big open source project, so if you have 
any suggestion about my proposal or my early implementation, 
feel free to tell me.


Thank you very much to everybody.

Lodovico Giaretta


Great! We really need proper XML support in Phobos.


Re: DlangUI on Android

2016-04-24 Thread Chris via Digitalmars-d-announce

On Sunday, 24 April 2016 at 06:19:14 UTC, thedeemon wrote:

On Saturday, 23 April 2016 at 18:16:38 UTC, Chris wrote:

Anyone interested in taking DlangUI and turning it into 
something like Swing/JavaFX for D?


What exactly do you mean by that?


Embrace DlangUI or something based on it in the same way DUB was 
embraced. Atm, only Vadim works on it as a hobby. It would be a 
pity to see it come to a standstill one day - for what ever 
reason. I think a D based UI is important, especially now that D 
is getting some attention.


Re: Line spacing for '///ditto' on the website

2016-04-24 Thread Nick Treleaven via Digitalmars-d

On Saturday, 23 April 2016 at 20:50:31 UTC, Adam D. Ruppe wrote:

I still can't get over the ridiculous grey constraints. WTF.


It's much better reading signatures than before.

But what we could do is add a margin-bottom to them if needed, 
while keeping the others hugged up.


Good idea, probably only template symbols with constraints need 
the vertical whitespace.


BTW this is what it looks like on my docs: 
http://dpldocs.info/experimental-docs/std.algorithm.searching.endsWith.4.html


I found it a bit confusing at first. There should be 
expand/collapse buttons for overload details so you can compare 
them simultaneously. The current behaviour can still be kept too. 
I think template args should not be elided completely in the 
summary, at least (...) should be shown in the signature.


I think there are too many line breaks, maybe this instead:

Function endsWith -> bool @anyAttributes
(alias pred, R)
(R doesThisEnd)
if (isInputRange!R &&
ifTestable!(typeof(doesThisEnd.front), unaryFun!pred))


Re: An important pull request: accessing shared affix for immutable data

2016-04-24 Thread Marco Leise via Digitalmars-d
Am Sat, 13 Feb 2016 19:16:43 +0100
schrieb Timon Gehr :

> Not necessarily. shared is transitive and prefix/suffix are arbitrary 
> types which might contain mutable indirections.

I don't want to disturb your conversation, but how about
designing a working "shared" first? My last attempt at
using it on aggregate fields was frustrating and asked for a
complete redesign, similar to "inout".

Some of my most frustrating moments, some of which I discussed
with Sean Kelly who had a better understanding of the runtime:

Ramblings on the FAQ on shared:
http://www.digitalmars.com/d/archives/digitalmars/D/D_2.0_FAQ_on_shared_246071.html

None of core.sync is shared:
http://www.digitalmars.com/d/archives/digitalmars/D/learn/m_condition.mutex_cannot_be_used_in_shared_method_64874.html

When casting away shared I needed a way to pass a "depth"
to the case, resulting in this template by John Colvin (where
depth is reduced to 1 level or all, but you get the idea):
http://www.digitalmars.com/d/archives/digitalmars/D/learn/How_do_you_get_T_from_shared_T_64230.html

Cannot destroy a shared struct:
http://www.digitalmars.com/d/archives/digitalmars/D/learn/How_to_destroy_a_shared_struct._55603.html

Here I tried to do away with the explicit casts by listing the
variables that are protected under a specific mutex:
http://www.digitalmars.com/d/archives/digitalmars/D/New_scope_modifier_unshared_for_temporary_ownership_of_shared_228907.html

--
Marco



Will the GC scan this pointer?

2016-04-24 Thread Lass Safin via Digitalmars-d-learn

// Omitting the required imports.

void[] ptr;

void main() {
uint buffer;
glCreateBuffers(1, );
// Filling the buffer with data and such...
ptr = glMapNamedBufferRange(buffer, 0, 512, GL_MAP_WRITE_BIT 
| GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT)[0 .. 512];

}

So the question is: Will the GC scan ptr? As you can see, it is a 
write-only pointer, so reading from it will cause undefined 
behavior (such as return data which looks like a pointer to 
data..), and can potentially be reallly slow.


Do I have to mark it with NO_SCAN each time I call 
glMapNamedBufferRange?


Re: Who wore it better?

2016-04-24 Thread Nick Treleaven via Digitalmars-d
On Friday, 15 April 2016 at 18:46:01 UTC, Steven Schveighoffer 
wrote:

inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2)


Might be nice if inout applied to template parameter types:

T[] overlap(inout T)(T[] r1, T[] r2);

If it wasn't for the virtual function issue, I wonder if inout 
would still be needed on runtime arguments given the above 
feature?


Using traits like CopyConstness might be enough.


Re: GSoC 2016 - A replacement of std.xml for the Phobos standard library

2016-04-24 Thread Lodovico Giaretta via Digitalmars-d

On Saturday, 23 April 2016 at 18:49:00 UTC, Jack Stouffer wrote:
If you want, you can get more feedback by submitting a work in 
progress PR to Phobos so people can see the development of the 
library and comment on it as you go. This would also allow you 
to test your code with the Phobos CI which has a 10 different 
platforms.


This is a very good idea, but I think I'll not apply it now. In 
my opinion, the code is not mature enough to be integrated with 
Phobos. I hope that for May 23rd (when GSoC coding phase 
officially begins) my repository will have switched from the 
"sketch" phase to the "development towards an almost-well-defined 
design" phase. In that case, I'll submit a PR, so that the 
details of interfaces and implementation can be easily discussed.




Re: GSoC 2016 - A replacement of std.xml for the Phobos standard library

2016-04-24 Thread Lodovico Giaretta via Digitalmars-d

On Saturday, 23 April 2016 at 14:38:36 UTC, Seb wrote:

Do you know about these two projects?

https://github.com/jacob-carlborg/orange
https://github.com/s-ludwig/std_data_json

It would be great if your xml library could work with the 
proposed std.data specification. Ideally switching from Json 
output to xml output, should be changing one line.


--- WARNING: NOOB QUESTION ---
I've heard something about std.data, but I know almost nothing 
about it. Where can I find the proposed specification?

--- END OF NOOB QUESTION ---

By the way, I think that std.xml will end up having lots of 
compile-time configurations (via templates), so it will have a 
simple wrapper on top of it, which can of course obey the 
std.data specification. This will allow casual users to have the 
job done in a few lines without any pain.





Directions to Ibis Hotel in Berlin from Tegel Airport

2016-04-24 Thread Walter Bright via Digitalmars-d
The hotel emailed them to me, I presume they know what they're doing :-) so I 
thought I'd share:


Bus 109 to Jakob-Kaiser-Platz
Subway U 7 in the direction of Rudow to Grenzallee
Cross the street at the traffic light and turn left. The next street on the 
right is Jahnstraße.

On the left side you will find our hotel.


Re: How do you use D to launch/open a window?

2016-04-24 Thread Satoshi via Digitalmars-d-learn

On Friday, 22 April 2016 at 21:13:31 UTC, anonymousuer wrote:
What code is needed to tell D to open a window? Thank you in 
advance.


You can choose between existing libraries or wrappers for GUI 
implementation like:
DlangUI, Qt, ..., (or my new GUI framework called Rikarin what 
will be avaiable soon).


If you want just create window for e.g. OpenGL context you can 
use WinAPI CreateWindow or wrappers like SDL or GLFW


Re: Line spacing for '///ditto' on the website

2016-04-24 Thread default0 via Digitalmars-d

On Saturday, 23 April 2016 at 20:50:31 UTC, Adam D. Ruppe wrote:

On Saturday, 23 April 2016 at 20:06:39 UTC, ag0aep6g wrote:

On 23.04.2016 21:53, Andrei Alexandrescu wrote:

Should we use a single ? -- Andrei


That would look better in the case you linked, but it would be 
a step back with longer signatures. E.g.

http://dlang.org/phobos/std_algorithm_searching.html#.endsWith


I still can't get over the ridiculous grey constraints. WTF.

But what we could do is add a margin-bottom to them if needed, 
while keeping the others hugged up.


BTW this is what it looks like on my docs: 
http://dpldocs.info/experimental-docs/std.algorithm.searching.endsWith.4.html


Only thing I dislike about it is that the "Overload: signature>" thing of the currently selected overload vanishes 
completely, instead of just changing color to suggest it is the 
active one you selected.


Also, your search currently does not list modules as search 
results (try searching base64, it will only show things like the 
Base64/Base64Impl things etc).


Anyhow I really should be using your docs by now, seems the 
timeframe where you hit a "this has not been implemented yet, 
sorry"-warning on half the links you click on is finally over and 
being able to actually read constraints and having a better 
overview (via the toggling of the full signature) with function 
overloads alone are huge selling points, not to mention it does 
not try to cram the documentation for whole modules on a single 
page but splits it nicely into single pages for functions etc.


[Issue 13698] ICE(e2ir.c) on on simd call

2016-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13698

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/c8700645b3148c26ae3ffe9bf24d621ae26223b7
fix Issue 13698 - ICE(e2ir.c) on on simd call

https://github.com/dlang/dmd/commit/78b065d9e445ac99e9cd6f8372fe626b17ac414b
Merge pull request #5685 from WalterBright/fix13698

fix Issue 13698 - ICE(e2ir.c) on on simd call

--


Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread deadalnix via Digitalmars-d
On Saturday, 23 April 2016 at 15:29:08 UTC, Andrei Alexandrescu 
wrote:
Yah, that's the canonical. I forgot why I chose (x & -x) > (x - 
1) over it.


I'm not sure why do you test against x - 1 when you could test 
for equality. Not only it looks like it is going to require an 
extra computation (x - 1) but also it doesn't work for 0.


Re: Checking if an Integer is an Exact Binary Power

2016-04-24 Thread deadalnix via Digitalmars-d

On Saturday, 23 April 2016 at 13:04:00 UTC, Nordlöw wrote:
Wanted: CT-trait and run-time predicate for checking whether 
its single integer parameter is an exact power of two.


I guess

https://dlang.org/phobos/std_math.html#.truncPow2

or

https://dlang.org/phobos/std_math.html#.nextPow2

could be reused, but I bet there's a more efficient way of 
checking this.


Note that (A | B) & -(A | B) will give you the minimal power of 2 
that divide A and B.


Now, if A == B, you get (A & -A) == A to test if A is a power of 
2.


Re: DlangUI on Android

2016-04-24 Thread thedeemon via Digitalmars-d-announce

On Saturday, 23 April 2016 at 18:16:38 UTC, Chris wrote:

Anyone interested in taking DlangUI and turning it into 
something like Swing/JavaFX for D?


What exactly do you mean by that?