Re: fPIC Error

2016-11-18 Thread deadalnix via Digitalmars-d-learn
On Thursday, 3 November 2016 at 06:11:48 UTC, rikki cattermole wrote: [Environment32] DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import -L-L/usr/lib/i386-linux-gnu -L--export-dynamic -fPIC -defaultlib=libphobos2.so [Environment64] DFLAGS=-I/usr/include/dmd/phobos

Re: function pointer when a function is overloaded.

2012-07-01 Thread deadalnix
Le 01/07/2012 01:59, dnewbie a écrit : import std.stdio; alias void function(int) fooInt; alias void function(long) fooLong; int main(string[] args) { fooInt f1 = foo; fooLong f2 = foo; f1(1L); f2(1L); return 0; } void foo(int i) { writeln(foo(int i)); } void foo(long i) { writeln(foo(long

function pointer when a function is overloaded.

2012-06-30 Thread deadalnix
Simple question. How to I get a function pointer to one of the foo functions in this case : void foo(int i); void foo(long i);

Re: How do I force something onto the heap? (need for libev)

2012-03-06 Thread deadalnix
Le 06/03/2012 05:34, Tyler Jameson Little a écrit : I've been playing with libev in D lately, and I've run into a problem. I've been able to hack around it, but it'd like to find a better, more general solution. Here's a link to the code:

Re: D runtime Garbage Collector details

2012-02-24 Thread deadalnix
Le 24/02/2012 00:49, Vadim a écrit : I am looking for the details on D Garbage Collection implementation. I will much appreciate if someone suggests the answers or give some links to existing documentation clarifying the following points: 1. Is it Mark-n-Sweep or copy or generational collector

Re: Pure and higher-order functions

2012-02-23 Thread deadalnix
Le 23/02/2012 21:00, mist a écrit : Hello! I have been asked few question recently from a Haskell programmer about D2 and, after experimenting a bit, have found that I really can't provide a good answe myself, as I am not getting a design limititations (if any). Here is the snippet, it is

Re: delegate as memeber

2012-02-22 Thread deadalnix
Le 22/02/2012 03:59, Vladimir Panteleev a écrit : On Tuesday, 21 February 2012 at 15:41:58 UTC, deadalnix wrote: Le 21/02/2012 16:32, Vladimir Panteleev a écrit : On Tuesday, 21 February 2012 at 15:22:15 UTC, deadalnix wrote: struct stuff { private Exception delegate() exceptionBuilder

Re: delegate as memeber

2012-02-22 Thread deadalnix
Le 21/02/2012 18:46, Jacob Carlborg a écrit : On 2012-02-21 16:55, deadalnix wrote: Le 21/02/2012 16:48, Adam D. Ruppe a écrit : A possible workaround is to initialize the delegate in the object's constructor. It is a struct. And struct don't have default constructor. It lead to very

Re: inout problems

2012-02-22 Thread deadalnix
Le 22/02/2012 05:01, Andrej Mitrovic a écrit : class Foo { this(int) inout { } Foo makeFoo() { return new Foo(1); } } void main() { } test.d(8): Error: cannot implicitly convert expression (new Foo(1)) of type inout(Foo) to test.Foo Is this a bug? inout is supposed to

delegate as memeber

2012-02-21 Thread deadalnix
struct stuff { private Exception delegate() exceptionBuilder = delegate Exception() { return new Exception(foobar); }; } The following piece of code trigger a compiler error : delegate module.stuff.__dgliteral1 function literals cannot be class members Why is

Re: delegate as memeber

2012-02-21 Thread deadalnix
Le 21/02/2012 16:32, Vladimir Panteleev a écrit : On Tuesday, 21 February 2012 at 15:22:15 UTC, deadalnix wrote: struct stuff { private Exception delegate() exceptionBuilder = delegate Exception() { return new Exception(foobar); }; } The following piece of code trigger a compiler error

Re: delegate as memeber

2012-02-21 Thread deadalnix
Le 21/02/2012 16:48, Adam D. Ruppe a écrit : A possible workaround is to initialize the delegate in the object's constructor. It is a struct. And struct don't have default constructor. It lead to very segfault prone code (I did try that).

Re: delegate as memeber

2012-02-21 Thread deadalnix
Le 21/02/2012 17:30, Mantis a écrit : 21.02.2012 17:24, deadalnix пишет: struct stuff { private Exception delegate() exceptionBuilder = delegate Exception() { return new Exception(foobar); }; } The following piece of code trigger a compiler error : delegate module.stuff.__dgliteral1 function

Re: Anti-OOP... stupid?

2012-02-14 Thread deadalnix
IMO, what would be stupid is that everything has to be object oriented. You have problems where OOP is good, and other where it isn't. Use the tool that fit what you want to accomplish. Screwdriver are great, but are useless when you are dealing with a nail. On Tuesday, 14 February 2012

Re: Restrict access to critical functions

2011-12-15 Thread deadalnix
Le 14/12/2011 13:48, Timon Gehr a écrit : On 12/14/2011 01:28 PM, Kagamin wrote: Goal would be to have a possibility to compile and let run code from random people (some of them perhaps evil minded), watch over the processes and kill them, if they take too long or use up too much memory. I

Re: Array initialization quiz

2011-11-29 Thread deadalnix
Le 29/11/2011 04:11, Andrej Mitrovic a écrit : On 11/29/11, bearophilebearophileh...@lycos.com wrote: Do you know why the compiler doesn't ask you for a cast, and why the run does that? Because foreach is broken? http://d.puremagic.com/issues/show_bug.cgi?id=4510 No it has nothing to do

Re: Make a variable single-assignment?

2011-11-21 Thread deadalnix
Le 21/11/2011 15:04, Alex Rønne Petersen a écrit : Hi, Is there any way to make a variable single-assignment, regardless of its type? I.e.: void foo() { some magical keyword? int i = 0; i = 2; // Error: i cannot be reassigned } I realize const and immutable will do this, but they are

Re: Is there a portable way to limit memory/cpu usage of a D application?

2011-11-10 Thread deadalnix
Le 09/11/2011 18:12, Dejan Lekic a écrit : I would be satisfied with something like POSIX.1-2001 setrlimit() . Sure nothing prevents me from using setrlimit() in my D app, but perhaps it is something to think about a portable way of doing that. One thing I like about my Java apps is that I can

Re: Double implicitly converted to real

2011-11-03 Thread deadalnix
Le 03/11/2011 15:39, Charles McAnany a écrit : Hi. I noticed that one of the guarantees in TDPL is that any code that is valid in both C and D should compile with the same result. But I'm seeing a different behavior here. I'm trying to find the smallest double for which the comparison x+1/x =

Re: template expressions in C++ to an equivalent in D

2011-10-28 Thread deadalnix
, maybe I should reconside my project to port eigen. Deadalnix

Re: Implementing iterators for D custom data structures (best practices)

2011-10-17 Thread deadalnix
In addition, I would like to mention this confrence by Andrei Alexandrescu : http://blip.tv/boostcon/boostcon-2009-keynote-2452140 Le 17/10/2011 04:55, Jonathan M Davis a écrit : On Monday, October 17, 2011 10:22:42 Granville Barnett wrote: Hi All, I've not used D for long so hopefully this

Re: scope struct?

2011-10-17 Thread deadalnix
Nice trick ! However, in D, you have scope(exit) scope(success) and scope(failure) to do similar stuffs. I personally use both, on a case by case basis. Le 17/10/2011 06:47, Steve Teale a écrit : Is not needed because structs are inherently scope. I'm sure experienced D programmers do this

Re: operator ~ does not check type?

2011-10-12 Thread deadalnix
Le 12/10/2011 09:53, bearophile a écrit : Jonathan M Davis: int and dchar implicitly convert to one another for better or for worse. Personally, I'd prefer that they didn't, but that's the way that it is, so I don't believe that this is technically a bug. char-int is OK, but int-char is not

Re: How convice people that D it's wonderfull in a hour ?

2011-10-09 Thread deadalnix
Le 09/10/2011 12:00, Zardoz a écrit : Recently I've been asked if I could give a speech about D in my university. It will be of one hour of long. I not respond yet, but I think that I will do it. Actually I have the problem that I don't know well how explain well too many features and things of

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

2011-09-22 Thread deadalnix
DSFML2 doesn't exist right now. So no doubt you'll have trouble to compile it. I don't know what you are try to achieve, but definitively not what you believe. Note that my answer in the mentionned link give you all you need to use SFML with D. SFML2 is currently on a devellopement stage,

Heap fucntion calls

2011-09-21 Thread deadalnix
of such a function call or somethung similar. Thank by adavnce, deadalnix

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