Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-21 Thread Dmitry Olshansky
On 21.09.2011 4:04, Timon Gehr wrote: On 09/21/2011 01:57 AM, Christophe wrote: Jonathan M Davis , dans le message (digitalmars.D.learn:29637), a écrit : On Tuesday, September 20, 2011 14:43 Andrej Mitrovic wrote: On 9/20/11, Jonathan M Davisjmdavisp...@gmx.com wrote: Or

Re: Issuing compile-time warnings with line numbers?

2011-09-21 Thread Andrej Mitrovic
On 9/21/11, Jacob Carlborg d...@me.com wrote: Have a look at: http://d-programming-language.org/templates-revisited.html Right, but as I've said conv.to works at compile-time so that's unnecessary. Maybe adding a note there about this would be nice, so people don't spend time reimplementing

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-21 Thread Timon Gehr
On 09/21/2011 02:15 AM, Christophe wrote: Timon Gehr , dans le message (digitalmars.D.learn:29641), a écrit : Last point: WalkLength is not optimized for strings. std.utf.count should be. This short implementation of count was 3 to 8 times faster than walkLength is a simple benchmark: size_t

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-21 Thread Timon Gehr
On 09/21/2011 12:37 PM, Dmitry Olshansky wrote: On 21.09.2011 4:04, Timon Gehr wrote: On 09/21/2011 01:57 AM, Christophe wrote: Jonathan M Davis , dans le message (digitalmars.D.learn:29637), a écrit : On Tuesday, September 20, 2011 14:43 Andrej Mitrovic wrote: On 9/20/11, Jonathan M

Re: Issuing compile-time warnings with line numbers?

2011-09-21 Thread Jacob Carlborg
On 2011-09-21 13:59, Andrej Mitrovic wrote: On 9/21/11, Jacob Carlborgd...@me.com wrote: Have a look at: http://d-programming-language.org/templates-revisited.html Right, but as I've said conv.to works at compile-time so that's unnecessary. Maybe adding a note there about this would be nice,

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-21 Thread Christophe
Actually, I don't buy it. I guess the reason it's faster is that it doesn't check if the codepoint is valid. Why should it ? The documentation of std.utf.count says the string must be validly encoded, not that it will enforce that it is. Checking a string is valid everytime you use it would

Heap fucntion calls

2011-09-21 Thread deadalnix
D has a wonderfull feature named delegate. Delegate can acess local data, thus would be dangerous if thoses data were on the stack. For what I understand, when a delegate can access the local data of a function, those data are set on the heap instead of the stack, resulting on a slower

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-21 Thread zeljkog
On 21.09.2011 01:57, Christophe wrote: size_t myCount(string text) { size_t n = text.length; for (uint i=0; itext.length; ++i) { auto s = text[i]6; n -= (s1) - ((s+1)2); } return n; } Here is a more readable and a bit faster version on dmd windows: size_t

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-21 Thread Dmitry Olshansky
On 21.09.2011 18:47, Christophe wrote: Actually, I don't buy it. I guess the reason it's faster is that it doesn't check if the codepoint is valid. Why should it ? The documentation of std.utf.count says the string must be validly encoded, not that it will enforce that it is. Checking a string

Re: toUTFz and WinAPI GetTextExtentPoint32W

2011-09-21 Thread zeljkog
On 21.09.2011 19:12, Christophe Travert wrote: Nice. It is better with gdc linux 64bits too. I wanted to avoid conditional expressions like ?: but it's actually slightly faster that way. It is not compiled in as conditional jump.

Re: Heap fucntion calls

2011-09-21 Thread Simen Kjaeraas
On Wed, 21 Sep 2011 18:32:49 +0200, deadalnix deadal...@gmail.com wrote: D has a wonderfull feature named delegate. Delegate can acess local data, thus would be dangerous if thoses data were on the stack. For what I understand, when a delegate can access the local data of a function, those

Re: const-immutable array argument?

2011-09-21 Thread bearophile
Daniel Murphy: It's a bug, the compiler shouldn't be inserting a cast when the value implicitly converts. It's also a bug when the compiler tries to optimise away the variable to a literal when passing by reference, I've got a patch for this I haven't written up yet.

Re: Heap fucntion calls

2011-09-21 Thread deadalnix
Great answer ! Thank you very much, it answered almost everything ! But what about, in the exemple you gave me (which is great by the way) if foo as parameters ? Those parameters are passed on the stack by copy to the function, and then, copied to the heap (resulting in two copies) ? Le

Conditional Compilation with Version

2011-09-21 Thread alex
Hi Y'all!! Just as a note, I am new to the news group, but slightly less new to D =) Back on topic: I am unable to get multiple version specifications to work (from the website) sometihng like: version (foo) { version = bar; version = baz; } version (bar) { ... codes 'n' stuff }

Re: How to read output of a script

2011-09-21 Thread alex
On 09/20/2011 10:51 PM, Jonathan M Davis wrote: On Wednesday, September 21, 2011 04:40:34 Cheng Wei wrote: Thanks a lot. Weird. It is not in the library reference in http://www.d-programming- language.org/, but it is in the library reference in digitalmars.com. I throught the previous one was

I can't build dsfml2 or derelict.sfml whit dsss

2011-09-21 Thread Cuauhtémoc Ledesma
First at all sorry for my english. I've tried to build any binding of sfml in a 32-bit machine with archlinux. My problem with dsfml2 is similar to this http://www.digitalmars.com/d/archives/digitalmars/D/learn/Buliding_DSFML2_64-bit_Linux_25694.html. After installing mingw32-pthreads (what i