Re: Error while trying to allocate memory (malloc)

2012-08-06 Thread Eyyub
On Monday, 6 August 2012 at 13:59:35 UTC, CrudOMatic wrote: On Monday, 6 August 2012 at 13:22:08 UTC, Minas Mina wrote: Maybe you need a cast before malloc to convert it to a s_blockInfo*? Just did, and compiled. Errored out with (from my IDE): (9:54:32 AM) AccessViolation-Exception (9:54:32

Re: Function that calculates in compile time when it can

2012-08-06 Thread Eyyub
On Monday, 6 August 2012 at 13:46:14 UTC, Tobias Pankrath wrote: You can check for compile time with static if(__ctfe) No, you can't. __ctfe is a CTFE-ed(?) value. But you can do something like that : http://dpaste.dzfl.pl/e3f26239 Minas : I don't know if your PC is outdated, but it's

Re: Error while trying to allocate memory (malloc)

2012-08-06 Thread Eyyub
On Monday, 6 August 2012 at 14:55:05 UTC, CrudOMatic wrote: In C it was just declare and go... Really ? I don't think, because : s_blockHeader* m_blockList; Here, m_blockList is a pointer to s_blockHeader struct, and so the default value is `null`. So, trying to access to(?) a struct member

Re: Function that calculates in compile time when it can

2012-08-06 Thread Eyyub
On Monday, 6 August 2012 at 16:17:22 UTC, Minas Mina wrote: On Monday, 6 August 2012 at 15:56:52 UTC, Namespace wrote: Take a look into std.math: https://github.com/D-Programming-Language/phobos/blob/master/std/math.d I found this: real sin(real x) @safe pure nothrow; /* intrinsic */ And

Re: Function that calculates in compile time when it can

2012-08-06 Thread Eyyub
On Monday, 6 August 2012 at 16:21:04 UTC, Eyyub wrote: Justly, you see a normal runtime function, and a CTFE function is a normal runtime function(with some restrictions) that can be interpreted at runtime. *compile time, sorry

Re: Looking for D Programming tutorials

2012-08-05 Thread Eyyub
On Sunday, 5 August 2012 at 14:03:35 UTC, constantine wrote: Just finished setting up DMD2 with MonoD IDE, are there any good examples or tutorials to type and learn? Any recommended material to have look? Thanks. The D Programming Language by Andrei Alexandrescu, is the best way to learn

Why does foreach with __traits ignore ForeachTypeList's type ?

2012-08-04 Thread Eyyub
Hi, As I said on #d, foreach with __traits seems to ignore ForeachTypeList's type. Look at this ! :p http://dpaste.dzfl.pl/0885e1de Wtf ? Thanks

Re: Why does foreach with __traits ignore ForeachTypeList's type ?

2012-08-04 Thread Eyyub
It looks like the problem is TypeTuple : http://dpaste.dzfl.pl/de2264dd

Re: Why does foreach with __traits ignore ForeachTypeList's type ?

2012-08-04 Thread Eyyub
On Saturday, 4 August 2012 at 14:27:44 UTC, bearophile wrote: Eyyub: It looks like the problem is TypeTuple : http://dpaste.dzfl.pl/de2264dd Fixed in DMD 2.060? http://d.puremagic.com/issues/show_bug.cgi?id=5435 Bye, bearophile Oh, indeed. Sorry I did not look at the changelog before

Re: std.variant and delegate

2012-08-02 Thread Eyyub
On Thursday, 2 August 2012 at 20:36:53 UTC, Ali Çehreli wrote: On 08/02/2012 01:36 PM, Namespace wrote: On Thursday, 2 August 2012 at 20:33:02 UTC, Eyyub wrote: Hi, std.variant with delegate seems to be buggy : http://dpaste.dzfl.pl/24a87b46 Why the output is not 42 ? Thx writeln

Re: Parameter specialization

2012-07-21 Thread Eyyub
Okay ! The spec' should be more explicit, I'm sure that I'm not the first who asked this question ! Thanks Guys,

Parameter specialization

2012-07-20 Thread Eyyub
)) //works { return a + b; } void main() { assert(add(2, cast(short)2) == 4); } /code So, I infer that, in this case, TemplateTypeParameterSpecialization and TypeSpecialization(of IsExpression) aren't semantically equal ? What are differences between this 2 forms ? Eyyub, (I hope that I

Re: foreach for ranges?

2012-07-17 Thread Eyyub
On Tuesday, 17 July 2012 at 19:27:54 UTC, Jonathan M Davis wrote: It translates foreach(e; range) {} into something like foreach(auto __range = range; !__range.empty; __range.popFront()) { auto e = __range.front; } The compiler knows just enough about ranges to enable foreach, but

Re: foreach for ranges?

2012-07-17 Thread Eyyub
On Tuesday, 17 July 2012 at 19:45:45 UTC, Jonathan M Davis wrote: This post gives the current precedence, but there was some discussion of adjusting it a bit: http://forum.dlang.org/post/mailman.275.1342019430.31962.digitalmars- d...@puremagic.com From the looks of it, opApply gets

std.format.formattedRead and File.readln()

2012-06-02 Thread Eyyub
Hi, This following code won't compile : import std.stdio; import std.format; void main() { auto f = File(myfile.txt, r); uint life; formattedRead(f.readln(), Life %s, life); // Error 1 formattedRead(cast(string)f.readln(), Life %s, life); // Error 1

String and opBinary

2012-06-01 Thread Eyyub
Hi, I'd like to know why this following code doesn't compile : string opBinary(string op : *)(string data, string word) { string temp; foreach(letter; word) { temp ~= data; } return temp; } void main() { string word = foo; string

Re: String and opBinary

2012-06-01 Thread Eyyub
On Friday, 1 June 2012 at 19:37:38 UTC, Zhenya wrote: This code work import std.stdio; struct String { string data; alias data this; this(string s) { data = s; } String opBinary(string op : *)(string word) {

Re: String and opBinary

2012-06-01 Thread Eyyub
On Friday, 1 June 2012 at 21:26:55 UTC, Jonathan M Davis wrote: On Friday, June 01, 2012 22:18:50 Eyyub wrote: Why doesn't D allow a way to write operator overloading at scope-module level like in C++ ?(in this case) Why would you need to? It only works when defining them for user-defined

Re: Contracts inheritance

2012-04-16 Thread Eyyub
On Friday, 13 April 2012 at 22:23:25 UTC, Ali Çehreli wrote: On 04/13/2012 03:07 PM, Eyyub wrote: Hai, After watching Walter's video at Lang.NEXT, I have wanted to know how contracts inheritance works. In the following code, I don't understand why foo.bar(2) works...but with the sames

Contracts inheritance

2012-04-13 Thread Eyyub
Hai, After watching Walter's video at Lang.NEXT, I have wanted to know how contracts inheritance works. In the following code, I don't understand why foo.bar(2) works...but with the sames contracts in the foo function it doesn't work. http://paste.pocoo.org/show/3Ab5IiQk6hTiJ0jAFZWv/

Re: Operator Overloading with class template

2012-04-09 Thread Eyyub
On Monday, 9 April 2012 at 09:09:05 UTC, James Miller wrote: * Eyyub eyyub.pangeara...@gmail.com [2012-04-09 01:14:32 +0200]: Hello, How can I rewrite the exemple 2 (http://pastebin.com/q50903Zh) in D lang. ? This source code doesn't work...why ? http://paste.pocoo.org/show

Re: Operator Overloading : opOpAssign

2012-04-08 Thread Eyyub
On Sunday, 8 April 2012 at 18:05:58 UTC, Timon Gehr wrote: On 04/08/2012 07:56 PM, Eyyub wrote: Hai, I would to know how to overload this operator and why I have this error at compile-time : http://paste.pocoo.org/show/vlfSSekGLCAriCJpiZvp/ Thanks a lot. Try void opOpAssign(string op

Re: Operator Overloading : opOpAssign

2012-04-08 Thread Eyyub
Ho, if I replace a+=b; by a.opOpAssign!+(b); it works...why ?

Re: Operator Overloading : opOpAssign

2012-04-08 Thread Eyyub
arthur: It still does not work to, I think that is a bug.

Re: Operator Overloading : opOpAssign

2012-04-08 Thread Eyyub
It works with : http://paste.pocoo.org/show/4oIhMg5eBdUoirhk5iYS/ Thanks for all, kiss !

Re: Operator Overloading with class template

2012-04-08 Thread Eyyub
On Sunday, 8 April 2012 at 23:44:12 UTC, Francois Chabot wrote: On Sunday, 8 April 2012 at 23:41:51 UTC, Francois Chabot wrote: On Sunday, 8 April 2012 at 23:14:33 UTC, Eyyub wrote: Hello, How can I rewrite the exemple 2 (http://pastebin.com/q50903Zh) in D lang. ? This source code doesn't

Re: Operator Overloading with class template

2012-04-08 Thread Eyyub
On Monday, 9 April 2012 at 00:04:50 UTC, Andrej Mitrovic wrote: On 4/9/12, Eyyub eyyub.pangeara...@gmail.com wrote: Np :D, you don't know how can I do for the example 2 ? Well for one thing, there are no global operators in D. Others might help out with writing a proper opBinary that's

Re: Object.factory failed with nested class

2012-02-12 Thread Eyyub
On Sunday, 12 February 2012 at 23:33:26 UTC, Timon Gehr wrote: In theory it could work for only static local classes, but that does not work too. It is an arbitrary restriction. Classes instantiated by Object.factory must reside at module scope. Mmh, ok I understood ! Thanks a lot for your

Re: Raw socket TCP/IP

2012-02-08 Thread Eyyub
BUMP, I really need help please ! Eyyub.

Re: Raw socket TCP/IP

2012-02-05 Thread Eyyub
, ID_HDRINCL with setsockopt indicates the application provides the IP header but in D' there isn't this option :/ . Thanx Eyyub,(sorry for ma bad english)

Re: Raw socket TCP/IP

2012-02-05 Thread Eyyub
If the source code can help : http://paste.pocoo.org/show/OJK11zDw6jAaurlKLT3Z/ . Eyyub,

Raw socket TCP/IP

2012-02-04 Thread Eyyub
Hi, I'm trying to use a raw socket, but when I create a socket(AddressFamily.INET, SocketType.RAW, ProtocolType.TCP) and then I use socket.sendTo(datagram, addr) I've got a 10002 code error Invalid argument... Can anyone help me please, and sorry for my bad english :s

Why immutable ?

2010-12-12 Thread Eyyub
I recently upgraded to the D 2, and i would like understand for which reason they are the immutable keyword ! Thx