Re: Unable to use tradional tools to find memory leaks

2013-09-21 Thread Maxim Fomin
On Saturday, 21 September 2013 at 17:03:14 UTC, Brad Roberts wrote: On 9/21/13 9:01 AM, Maxim Fomin wrote: On Saturday, 21 September 2013 at 14:30:19 UTC, Flamaros wrote: I tried to used Valgrind (Linux) and Dr Memory (Windows) without success to find a big leak I have in my application. But b

Re: core.sys.posix.unistd link error

2013-09-21 Thread Jonathan M Davis
On Saturday, September 21, 2013 20:30:00 Ruslan Mullakhmetov wrote: > i use pipe() syscall from my program. when i compile it I got the > following msg: > > Error: pipe cannot be interpreted at compile time, because it has > no available source code > > how can i fix it? > > dmd 2.063.2, Mac OS

Re: [OT] Pathfinding algorithm

2013-09-21 Thread Joseph Rushton Wakeling
On 21/09/13 21:13, Gary Willoughby wrote: Maybe i'm wrong but i'm assuming you are pre-calculating the shortest paths from each node to all others is because you intend to traverse a path at some point in the future? The problem with this approach is that if a node is marked as impassable then yo

Re: [OT] Pathfinding algorithm

2013-09-21 Thread Gary Willoughby
On Saturday, 21 September 2013 at 15:49:00 UTC, rasmus svensson wrote: Assuming the shortest path from from all nodes to every other node is already pre-computed: What is a fast algorithm to update all paths, if one node is marked as inpassible. Any good 3rd party library or research paper o

Re: [OT] Pathfinding algorithm

2013-09-21 Thread Joseph Rushton Wakeling
On 21/09/13 17:48, rasmus svensson wrote: Assuming the shortest path from from all nodes to every other node is already pre-computed: What is a fast algorithm to update all paths, if one node is marked as inpassible. Any good 3rd party library or research paper out there? This is on the basi

core.sys.posix.unistd link error

2013-09-21 Thread Ruslan Mullakhmetov
i use pipe() syscall from my program. when i compile it I got the following msg: Error: pipe cannot be interpreted at compile time, because it has no available source code how can i fix it? dmd 2.063.2, Mac OS X

Re: Unable to use tradional tools to find memory leaks

2013-09-21 Thread David Nadlinger
On Saturday, 21 September 2013 at 17:03:14 UTC, Brad Roberts wrote: That's wrong. Both DMD and Valgrind are software, both of which can be debugged and changed. Please file appropriate bug reports, hopefully with nicely minimized test cases. I ran into an issue like this once where DMD would

Re: Unable to use tradional tools to find memory leaks

2013-09-21 Thread Brad Roberts
On 9/21/13 9:01 AM, Maxim Fomin wrote: On Saturday, 21 September 2013 at 14:30:19 UTC, Flamaros wrote: I tried to used Valgrind (Linux) and Dr Memory (Windows) without success to find a big leak I have in my application. But both tools can't launch my application without make it crash. Is app

Re: Unable to use tradional tools to find memory leaks

2013-09-21 Thread Flamaros
On Saturday, 21 September 2013 at 16:01:17 UTC, Maxim Fomin wrote: On Saturday, 21 September 2013 at 14:30:19 UTC, Flamaros wrote: I tried to used Valgrind (Linux) and Dr Memory (Windows) without success to find a big leak I have in my application. But both tools can't launch my application with

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread Dicebot
On Saturday, 21 September 2013 at 16:09:35 UTC, simendsjo wrote: On Saturday, 21 September 2013 at 15:43:11 UTC, Maxim Fomin wrote: On Saturday, 21 September 2013 at 11:13:57 UTC, simendsjo wrote: I want to know if a variable has changed .init, but I don't know if it's possible if the .init val

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread monarch_dodra
On Saturday, 21 September 2013 at 16:09:35 UTC, simendsjo wrote: On Saturday, 21 September 2013 at 15:43:11 UTC, Maxim Fomin wrote: On Saturday, 21 September 2013 at 11:13:57 UTC, simendsjo wrote: I want to know if a variable has changed .init, but I don't know if it's possible if the .init val

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread simendsjo
On Saturday, 21 September 2013 at 15:43:11 UTC, Maxim Fomin wrote: On Saturday, 21 September 2013 at 11:13:57 UTC, simendsjo wrote: I want to know if a variable has changed .init, but I don't know if it's possible if the .init value is the same. Does anyone have a solution for this? int a;

Re: Unable to use tradional tools to find memory leaks

2013-09-21 Thread Maxim Fomin
On Saturday, 21 September 2013 at 14:30:19 UTC, Flamaros wrote: I tried to used Valgrind (Linux) and Dr Memory (Windows) without success to find a big leak I have in my application. But both tools can't launch my application without make it crash. Is application crashing without these tools? P

[OT] Pathfinding algorithm

2013-09-21 Thread rasmus svensson
Assuming the shortest path from from all nodes to every other node is already pre-computed: What is a fast algorithm to update all paths, if one node is marked as inpassible. Any good 3rd party library or research paper out there?

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread Maxim Fomin
On Saturday, 21 September 2013 at 11:35:11 UTC, bearophile wrote: init is part of a type and you can't change it. Bye, bearophile Well, D wouldn't be D, if it did not allow something like this for aggregate types: import core.stdc.string, std.stdio; pure hack(T)(T value) if (is(T == class

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread Maxim Fomin
On Saturday, 21 September 2013 at 11:13:57 UTC, simendsjo wrote: I want to know if a variable has changed .init, but I don't know if it's possible if the .init value is the same. Does anyone have a solution for this? int a; int b = 0; pragma(msg, a.init); // 0 pragma(msg, b.ini

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread Namespace
On Saturday, 21 September 2013 at 14:11:44 UTC, simendsjo wrote: On Saturday, 21 September 2013 at 13:55:00 UTC, Dicebot wrote: On Saturday, 21 September 2013 at 13:48:00 UTC, simendsjo wrote: On Saturday, 21 September 2013 at 13:38:44 UTC, Dicebot wrote: On Saturday, 21 September 2013 at 13:30

Unable to use tradional tools to find memory leaks

2013-09-21 Thread Flamaros
I tried to used Valgrind (Linux) and Dr Memory (Windows) without success to find a big leak I have in my application. But both tools can't launch my application without make it crash. Do I need do something particular, to have a chance to see one of those tool working fine with my application?

Re: Syntax for heap allocated void initialized arrays

2013-09-21 Thread Joseph Rushton Wakeling
On 21/09/13 16:23, bearophile wrote: I think that's sufficiently safe. If the GC run before you have initialized those fields, and some of those fields are references/pointers, that could cause memory leaks until the next time the GC runs. Thanks for clarifying where un vs. minimally matters --

Re: Syntax for heap allocated void initialized arrays

2013-09-21 Thread bearophile
simendsjo: I'm setting every element in the array, and every field of the element, so I should be safe, right? I think that's sufficiently safe. If the GC run before you have initialized those fields, and some of those fields are references/pointers, that could cause memory leaks until the n

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread simendsjo
On Saturday, 21 September 2013 at 13:55:00 UTC, Dicebot wrote: On Saturday, 21 September 2013 at 13:48:00 UTC, simendsjo wrote: On Saturday, 21 September 2013 at 13:38:44 UTC, Dicebot wrote: On Saturday, 21 September 2013 at 13:30:19 UTC, simendsjo wrote: I'm though of using if for aggregates,

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread Dicebot
On Saturday, 21 September 2013 at 13:48:00 UTC, simendsjo wrote: On Saturday, 21 September 2013 at 13:38:44 UTC, Dicebot wrote: On Saturday, 21 September 2013 at 13:30:19 UTC, simendsjo wrote: I'm though of using if for aggregates, yes. But this doesn't handle the case where you set the same va

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread simendsjo
On Saturday, 21 September 2013 at 13:38:44 UTC, Dicebot wrote: On Saturday, 21 September 2013 at 13:30:19 UTC, simendsjo wrote: I'm though of using if for aggregates, yes. But this doesn't handle the case where you set the same value is T.init. I don't think those two case are any different fr

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread Dicebot
On Saturday, 21 September 2013 at 13:30:19 UTC, simendsjo wrote: I'm though of using if for aggregates, yes. But this doesn't handle the case where you set the same value is T.init. I don't think those two case are any different from the type system point of view, manual or default.

Re: Syntax for heap allocated void initialized arrays

2013-09-21 Thread simendsjo
On Saturday, 21 September 2013 at 11:36:32 UTC, bearophile wrote: simendsjo: Thanks. uninitializedArray works well for my need. uninitializedArray is the wrong function to use in 99.9% of the times. std.array docs probably have not explained you well enough the risks of its usage. Bye, be

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread simendsjo
On Saturday, 21 September 2013 at 12:50:20 UTC, Andrej Mitrovic wrote: On 9/21/13, bearophile wrote: I think there is no simple way to know if a variable has being default-initialized or not. Why do you want to know it? There is however a way to extract it if it's a part of an aggregate: -

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread Andrej Mitrovic
On 9/21/13, bearophile wrote: > I think there is no simple > way to know if a variable has being default-initialized or not. > Why do you want to know it? There is however a way to extract it if it's a part of an aggregate: - struct S { int x = 1; } void main() { static assert(S.x.i

Re: Syntax for heap allocated void initialized arrays

2013-09-21 Thread bearophile
simendsjo: Thanks. uninitializedArray works well for my need. uninitializedArray is the wrong function to use in 99.9% of the times. std.array docs probably have not explained you well enough the risks of its usage. Bye, bearophile

Re: Is there a way to see if .init has been set by the user?

2013-09-21 Thread bearophile
simendsjo: I want to know if a variable has changed .init, but I don't know if it's possible if the .init value is the same. Does anyone have a solution for this? int a; int b = 0; pragma(msg, a.init); // 0 pragma(msg, b.init); // 0 // how can I see that b has "= 0"? ini

Is there a way to see if .init has been set by the user?

2013-09-21 Thread simendsjo
I want to know if a variable has changed .init, but I don't know if it's possible if the .init value is the same. Does anyone have a solution for this? int a; int b = 0; pragma(msg, a.init); // 0 pragma(msg, b.init); // 0 // how can I see that b has "= 0"?

Re: Syntax for heap allocated void initialized arrays

2013-09-21 Thread simendsjo
On Saturday, 21 September 2013 at 10:40:07 UTC, bearophile wrote: simendsjo: This is incorrect, but what is the correct syntax? The arrays page only says it's "an advanced feature", but doesn't show the syntax. int[] a = new int[1](void); The simplest way to allocate a void-initialized GC-

Re: Syntax for heap allocated void initialized arrays

2013-09-21 Thread bearophile
simendsjo: This is incorrect, but what is the correct syntax? The arrays page only says it's "an advanced feature", but doesn't show the syntax. int[] a = new int[1](void); The simplest way to allocate a void-initialized GC-managed dynamic array in D is probably to use one of the two funct

Re: Linker error

2013-09-21 Thread Namespace
On Wednesday, 29 May 2013 at 21:17:29 UTC, Namespace wrote: Why is the phobos lib automatically detected with dmd 2.062 , but not with 2.063? Any other answer? I have the same problem again. And I hate it.

Syntax for heap allocated void initialized arrays

2013-09-21 Thread simendsjo
This is incorrect, but what is the correct syntax? The arrays page only says it's "an advanced feature", but doesn't show the syntax. int[] a = new int[1](void);