Is there any usable profiler for D2?
Is there any usable profiler for D2?
dmd -profile
On Tuesday, September 20, 2011 08:35:52 Mirko Pilger wrote:
Is there any usable profiler for D2?
dmd -profile
I don't believe that it doesn't currently work with 64-bit binaries though, so
if you want to run the profiler, you're going to need to do it with a 32-bit
binary (which as all you
Someone who has actually done a C or C++ application or two which used D code
should answer this question. I know that there are at least a few folks around
here who have done that, but I've never done it myself.
http://stackoverflow.com/questions/7480046/implementing-a-c-api-in-d
On Mon, 19 Sep 2011 23:09:45 +0100, Simen Kjaeraas
simen.kja...@gmail.com wrote:
On Mon, 19 Sep 2011 23:20:47 +0200, bearophile
bearophileh...@lycos.com wrote:
A tiny puzzle I've shown on IRC. This is supposed to create an inverted
array of cards, but what does it print instead?
import
In this bug report I have asked for better error messages:
http://d.puremagic.com/issues/show_bug.cgi?id=6696
But beside the error message, do you know why an immutable ref can't be given
to a function with a const ref argument? foo() can't change the contents of the
array a any way, so what's
bearophile , dans le message (digitalmars.D.learn:29609), a écrit :
what's wrong in this code?
void foo(const ref int[5] a) {}
void main() {
immutable int[5] arr;
foo(arr); // Error?
}
I don't think it is wrong. Did you try changind the order of const and
ref, or adding
Christophe:
I don't think it is wrong. Did you try changind the order of const and
ref, or adding parenthesis ?
I am trying now, and it seems the situation doesn't change.
Bye,
bearophile
bearophile Wrote:
In this bug report I have asked for better error messages:
http://d.puremagic.com/issues/show_bug.cgi?id=6696
But beside the error message, do you know why an immutable ref can't be given
to a function with a const ref argument? foo() can't change the contents of
the
On Tue, 20 Sep 2011 07:33:20 -0400, bearophile bearophileh...@lycos.com
wrote:
In this bug report I have asked for better error messages:
http://d.puremagic.com/issues/show_bug.cgi?id=6696
But beside the error message, do you know why an immutable ref can't be
given to a function with a
On Tue, 20 Sep 2011 07:33:20 -0400, bearophile bearophileh...@lycos.com
wrote:
In this bug report I have asked for better error messages:
http://d.puremagic.com/issues/show_bug.cgi?id=6696
But beside the error message, do you know why an immutable ref can't be
given to a function with a
Steven Schveighoffer schvei...@yahoo.com wrote in message
news:op.v13w8td2eav7ka@localhost.localdomain...
On Tue, 20 Sep 2011 07:33:20 -0400, bearophile bearophileh...@lycos.com
wrote:
void foo(const ref int[5] a) {}
void main() {
immutable int[5] arr;
foo(arr); // Error?
}
The
Hi,
I want something like:
bool test(HDC dc, string str, int len, SIZE* s)
{
wchar[] wstr = toUTFz!(wchar*)str;
GetTextExtentPoint32W(dc wstr.ptr, wstr.length, s);
...
I get the wchar[] stuff not working. I am struggling
with pointer to array. Could you give some advice?
Kind regards
Andre
bool test(HDC dc, string str, int len, SIZE* s)
{
wchar[] wstr = toUTFz!(wchar*)str;
GetTextExtentPoint32W(dc wstr.ptr, wstr.length, s);
toUTFz returns a wchar*, not a wchar[].
Am Tue, 20 Sep 2011 19:27:03 +0200 schrieb Trass3r:
bool test(HDC dc, string str, int len, SIZE* s)
{
wchar[] wstr = toUTFz!(wchar*)str;
GetTextExtentPoint32W(dc wstr.ptr, wstr.length, s);
toUTFz returns a wchar*, not a wchar[].
I am not familiar with pointers. I know I have to
call
Hi!
I'm working on a library written in D.
After some tests I have discovered that my library leaks memory, those leaks
are caused by dynamics array that I use in my library.
My question is:
Should dynamics array be deallocated automatically when a procedure returns?
There is another way to
On 09/20/2011 08:07 PM, Andre wrote:
Am Tue, 20 Sep 2011 19:27:03 +0200 schrieb Trass3r:
bool test(HDC dc, string str, int len, SIZE* s)
{
wchar[] wstr = toUTFz!(wchar*)str;
GetTextExtentPoint32W(dc wstr.ptr, wstr.length, s);
toUTFz returns a wchar*, not a wchar[].
I am not familiar with
On Tue, 20 Sep 2011 14:06:34 -0400, Dax d...@mailinator.com wrote:
Hi!
I'm working on a library written in D.
After some tests I have discovered that my library leaks memory, those
leaks are caused by dynamics array that I use in my library.
My question is:
Should dynamics array be
Are you sure that the call requires the string to be null terminated? I
do not know that winapi function, but this might work:
bool test(HDC dc, string str, SIZE* s)
{
auto wstr = to!(wchar[])str;
GetTextExtentPoint32W(dc, wstr.ptr, wstr.length, s);
...
It doesn't need to be null-terminated
On 09/20/2011 08:06 PM, Dax wrote:
Hi!
I'm working on a library written in D.
After some tests I have discovered that my library leaks memory, those leaks
are caused by dynamics array that I use in my library.
Does it 'leak'? What is your exact setup, why isn't the GC collecting
that
On 09/20/2011 08:34 PM, Trass3r wrote:
Are you sure that the call requires the string to be null terminated?
I do not know that winapi function, but this might work:
bool test(HDC dc, string str, SIZE* s)
{
auto wstr = to!(wchar[])str;
GetTextExtentPoint32W(dc, wstr.ptr, wstr.length, s);
...
On 09/20/2011 08:24 PM, Timon Gehr wrote:
On 09/20/2011 08:07 PM, Andre wrote:
Am Tue, 20 Sep 2011 19:27:03 +0200 schrieb Trass3r:
bool test(HDC dc, string str, int len, SIZE* s)
{
wchar[] wstr = toUTFz!(wchar*)str;
GetTextExtentPoint32W(dc wstr.ptr, wstr.length, s);
toUTFz returns a
Am Tue, 20 Sep 2011 20:44:40 +0200 schrieb Timon Gehr:
On 09/20/2011 08:24 PM, Timon Gehr wrote:
On 09/20/2011 08:07 PM, Andre wrote:
Am Tue, 20 Sep 2011 19:27:03 +0200 schrieb Trass3r:
bool test(HDC dc, string str, int len, SIZE* s)
{
wchar[] wstr = toUTFz!(wchar*)str;
Does it 'leak'? What is your exact setup, why isn't the GC collecting
that memory?
I have a Label class with a text() property that calls the procedure
that I have written in my first post and returns the result.
I have posted here because I was looking the memory usage (more
precisely
Steven Schveighoffer:
BTW, when posting questions like this, it is *immensely* helpful to give
exact error messages,
I have forgotten to do that by mistake. I am sorry.
Bye,
bearophile
Don't use length, use std.utf.count, ala:
import std.utf;
alias toUTFz!(const(wchar)*, string) toUTF16z;
GetTextExtentPoint32W(str.toUTF16z, std.utf.count(str), s);
I like to keep that alias for my code since I was already using it beforehand.
I'm pretty sure (ok maybe 80% sure) that
On 9/20/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
Or std.range.walkLength. I don't know why we really have std.utf.count. I
just
calls walkLength anyway. I suspect that it's a function that predates
walkLength and was made to use walkLength after walkLength was introduced.
But
it's
One other thing, count can only take an array which seems too
restrictive since walkLength can take any range at all. So maybe count
should be just an alias to walkLength or it should possibly be removed
(I'm against fully removing it because I already use it in code and I
think the name does make
To avoid having to change your other code, I'd do this:
wchar[] t = ...;
scope(exit) delete t; // add this line to the end of the function (after
returning)
There is another way, but it's not as easy:
// put this at the top of file
import core.memory;
...
scope(exit)
On Tuesday, September 20, 2011 14:43 Andrej Mitrovic wrote:
On 9/20/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
Or std.range.walkLength. I don't know why we really have std.utf.count. I
just
calls walkLength anyway. I suspect that it's a function that predates
walkLength and was made
On 9/20/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
We specifically avoid having aliases in Phobos simply for having alternate
function names. Aliases need to actually be useful, or they shouldn't be
there.
And function names have to be useful to library users. walkLength is
an awful name
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 Davis jmdavisp...@gmx.com wrote:
Or std.range.walkLength. I don't know why we really have std.utf.count. I
just
calls walkLength
Won't compile for obvious reasons:
struct Bar { }
struct Foo
{
this(Bar bar, int line = __LINE__)
{
pragma(msg, Warning: Constructing Foo with Bar incurs
precision loss. Line: ~ line);
}
}
void main()
{
auto foo = Foo(Bar());
}
That's just an example, but I want to
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 myCount(string text)
{
size_t n =
On Tuesday, September 20, 2011 17:18 Andrej Mitrovic wrote:
Won't compile for obvious reasons:
struct Bar { }
struct Foo
{
this(Bar bar, int line = __LINE__)
{
pragma(msg, Warning: Constructing Foo with Bar incurs
precision loss. Line: ~ line);
}
}
void main()
{
auto foo =
Ah, you're right. It should have been a compile-time argument, conv.to
actually works in CTFE:
import std.conv;
struct Bar { }
struct Foo
{
this(int line = __LINE__)(Bar bar)
{
pragma(msg, Warning: Constructing Foo with Bar incurs
precision loss. Line: ~ to!string(line));
}
}
On Tuesday, September 20, 2011 21:48:10 Christophe wrote:
To avoid having to change your other code, I'd do this:
wchar[] t = ...;
scope(exit) delete t; // add this line to the end of the function (after
returning)
There is another way, but it's not as easy:
// put this at the
I'd suggest having a version(warnings_suck) { static assert(0); }
so people who want more info can just stick a -version= on the build
and get the compiler's help.
static assert(0) gives a kind of compile time stack trace.
On 9/21/11, Adam D. Ruppe destructiona...@gmail.com wrote:
I'd suggest having a version(warnings_suck) { static assert(0); }
so people who want more info can just stick a -version= on the build
and get the compiler's help.
Yeah that was already planned, no worries. :)
In D2, how can we get the output of running a script.
We can use 'system' to run the script, but how we cannot assign the
standard output of the running script. Is there any way to do it, or
whether it will be included into future version of std.process? Thanks a
lot.
On Wednesday, September 21, 2011 03:31:11 Cheng Wei wrote:
In D2, how can we get the output of running a script.
We can use 'system' to run the script, but how we cannot assign the
standard output of the running script. Is there any way to do it, or
whether it will be included into future
On Tue, 20 Sep 2011 14:28:54 -0400, Steven Schveighoffer wrote:
You can deallocate the original array. The soon-to-be-deprecated method
(but easiest) is:
delete t;
To avoid having to change your other code, I'd do this:
wchar[] t = ...;
scope(exit) delete t; // add this line to the
#import std.process
void main() {
execvp(ip, route);
}
result:
Object ute is unknown, try ip help.
That is the first two bytes are lost
Adding two spaces works:
#import std.process
void main() {
execvp(ip, route);
}
Version 2.055, linux, 32bit
Thanks.
import std.process;
void main() {
execvp(ip, [route]);
}
result:
Object ute is unknown, try ip help.
So the first two bytes are lost.
After adding two spaces in the first argument, it works.
import std.process;
void main() {
execvp(ip, [ route]);
}
dmd 2.055 linux 32bit.
Is this a bug?
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 the official web site now. It seems it
still is not synced well.
45 matches
Mail list logo