Fast array copy. SIMD manual or automatic?

2015-02-06 Thread tcak via Digitalmars-d-learn
I have two char arrays at the size of 16KB. I will copy a part of data between them again and again. arrayA[0 .. dataLen] = arrayB[0 .. dataLen]; Does the compiler generate code that uses SIMD operations (128-bits memory copy) automatically, or do I need to do anything special for this?

Re: why GC not work?

2015-02-06 Thread ketmar via Digitalmars-d-learn
On Sat, 07 Feb 2015 04:30:07 +, Safety0ff wrote: > False pointers, current GC is not precise. not only that. constantly allocating big chunks of memory will inevitably lead to OOM due to current GC design. you can check it with manual freeing. there were some topics about it, and the soluti

Re: why GC not work?

2015-02-06 Thread Safety0ff via Digitalmars-d-learn
False pointers, current GC is not precise.

why GC not work?

2015-02-06 Thread mzfhhhh via Digitalmars-d-learn
import std.stdio; void testGC() { auto b = new byte[](1024*1024*100); writeln("malloc 100M!"); } void main() { foreach(i;1..100) { testGC(); } } -- core.exception.OutOfMemoryError@(0) win7 x86,dmd v2.066.0

Re: strange work of GC

2015-02-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 6 February 2015 at 20:38:07 UTC, Andrey Derzhavin wrote: As I think, the garbage collector should start destoying of the C1 and C2 objects of arr array during the "while" cycle prosess, but this does not happen. Dtors are not called. The D GC only runs on demand - typically, when y

Re: strange work of GC

2015-02-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 6 February 2015 at 21:07:14 UTC, anonymous wrote: This is you GC allocating in a destructor (the writeln calls). The GC can't handle that. Note that it isn't writeln itself, it is the ~ used in building the string. If you change that to a comma, it'll work better (writeln can take

Re: strange work of GC

2015-02-06 Thread anonymous via Digitalmars-d-learn
On Friday, 6 February 2015 at 20:38:07 UTC, Andrey Derzhavin wrote: As I think, the garbage collector should start destoying of the C1 and C2 objects of arr array during the "while" cycle prosess, but this does not happen. Dtors are not called. Garbage is only collected when you allocate memo

strange work of GC

2015-02-06 Thread Andrey Derzhavin via Digitalmars-d-learn
class C1 { int a1, b1, c1, d1, e1; string sdb1; this(string s) { sdb1 = s; a1=90; b1=19; d1=22; e1=23; } ~this() { if (sdb1 == "lll")

signal handling

2015-02-06 Thread Danny via Digitalmars-d-learn
Hi, if I want to clean up inside a signal handler and then exit the process (as it would have without me handling it), what do I do? Can I exit() inside a signal handler or should I use a more direct "quit now" function? (after all, it could have been in the middle of relinking the free list

Re: Arrays of Unions of Classes?

2015-02-06 Thread tcak via Digitalmars-d-learn
On Friday, 6 February 2015 at 18:55:30 UTC, DLearner wrote: I'm just wondering how I would go about reserving a section of the heap so I can have linear access to classes of different types. Storage space--not too worried about wasting; each class I want to store only has a few int sized variabl

Re: Arrays of Unions of Classes?

2015-02-06 Thread Ali Çehreli via Digitalmars-d-learn
On 02/06/2015 10:55 AM, DLearner wrote: > I can have linear access to classes of different types To be pedantic, you mean *objects* of different types. (Class is the type.) > Because classes are reference types, does that mean a union or an > array would only hold a reference to that class? Ye

Arrays of Unions of Classes?

2015-02-06 Thread DLearner via Digitalmars-d-learn
I'm just wondering how I would go about reserving a section of the heap so I can have linear access to classes of different types. Storage space--not too worried about wasting; each class I want to store only has a few int sized variables each and I'm not going to cry over a little padding. Becau

Re: Learning to XML with D

2015-02-06 Thread CraigDillabaugh via Digitalmars-d-learn
On Friday, 6 February 2015 at 14:15:44 UTC, Chris wrote: On Friday, 6 February 2015 at 14:11:19 UTC, CraigDillabaugh wrote: On Friday, 6 February 2015 at 14:09:51 UTC, CraigDillabaugh wrote: On Friday, 6 February 2015 at 11:39:32 UTC, Chris wrote: On Friday, 6 February 2015 at 09:15:54 UTC, De

Re: Issue with template function

2015-02-06 Thread ketmar via Digitalmars-d-learn
On Fri, 06 Feb 2015 17:09:28 +, Charles wrote: > readString(toBytes!string("test"),0,4).writeln; if you'll take a look into druntime sources, you'll find that string is just an alias to `immutable(char)[]`. so you actually doing thing: readString(toBytes!(immutable(char)[])("test

Re: Issue with template function

2015-02-06 Thread FG via Digitalmars-d-learn
On 2015-02-06 at 18:09, Charles wrote: readString(toBytes!char(['t','e','s','t']),0,4).writeln; readString(toBytes!string("test"),0,4).writeln;// This is line 39 That second line makes no sense (you didn't provide an array of strings). Why toBytes!string("test") and not to

Re: Issue with template function

2015-02-06 Thread Charles via Digitalmars-d-learn
Can I not do this cast because it's immutable?

Issue with template function

2015-02-06 Thread Charles via Digitalmars-d-learn
I'm trying to create a template function that can take in any type of array and convert it to a ubyte array. I'm not concerned with endianness at the moment, but I ran into a roadblock when trying to do this with strings. It already works with ints, chars, etc. Here's the relevant test code:

Re: Learning to XML with D

2015-02-06 Thread Chris via Digitalmars-d-learn
On Friday, 6 February 2015 at 14:11:19 UTC, CraigDillabaugh wrote: On Friday, 6 February 2015 at 14:09:51 UTC, CraigDillabaugh wrote: On Friday, 6 February 2015 at 11:39:32 UTC, Chris wrote: On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote: clip Thxxx The documentation says: "Warn

Re: Learning to XML with D

2015-02-06 Thread CraigDillabaugh via Digitalmars-d-learn
On Friday, 6 February 2015 at 14:09:51 UTC, CraigDillabaugh wrote: On Friday, 6 February 2015 at 11:39:32 UTC, Chris wrote: On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote: clip Thxxx The documentation says: "Warning: This module is considered out-dated and not up to Phobos' curr

Re: Learning to XML with D

2015-02-06 Thread CraigDillabaugh via Digitalmars-d-learn
On Friday, 6 February 2015 at 11:39:32 UTC, Chris wrote: On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote: So, I set sails to transform a bunch of HTML files with D. This, of course, will happen with the std.xml library. There is this nice example : http://dlang.org/phobos/std_xml.html#

Re: Learning to XML with D

2015-02-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 6 February 2015 at 11:39:32 UTC, Chris wrote: If you wanna use D for XML parsing, see if you can find a solid 3rd party library in D (have a look at Adam's github page: https://github.com/adamdruppe/, he has some DOM and HTML stuff up there). Yeah, if you're used to DOM work in Jav

Re: Learning to XML with D

2015-02-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote: OK, we're doing some event-base parsing, reacting with a lambda function on encountering so-and-do tag, à la SAX. (are we ?) yeah What I don't quite grab is the construct (in Element e) , especially the *in* part. Function parameters

Re: Learning to XML with D

2015-02-06 Thread via Digitalmars-d-learn
On Friday, 6 February 2015 at 11:39:32 UTC, Chris wrote: If you wanna use D for XML parsing, see if you can find a solid 3rd party library in D (have a look at Adam's github page: https://github.com/adamdruppe/, he has some DOM and HTML stuff up there). Another place to look is http://code.dl

Re: Trying to make a TCP server, client connects and disconnects immediately

2015-02-06 Thread FG via Digitalmars-d-learn
On 2015-02-06 at 05:17, Gan wrote: Oh sweet. Though if one message length is off by even 1 byte, then all future messages get corrupted? Yes, but you can easily detect that by adding a magic number and packet checksum to the header.

Re: Learning to XML with D

2015-02-06 Thread Chris via Digitalmars-d-learn
On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote: So, I set sails to transform a bunch of HTML files with D. This, of course, will happen with the std.xml library. There is this nice example : http://dlang.org/phobos/std_xml.html#.DocumentParser that I put to some use already, however so

Re: Why hibernated does not create tables automatically?

2015-02-06 Thread zhmt via Digitalmars-d-learn
Hi,Arjan,Thx for your replies, I have tried your suggestion, MySQLDriver driver = new MySQLDriver(); string url = MySQLDriver.generateUrl("10.211.55.10", 3306, "test"); string[string] params = MySQLDriver.setUserAndPassword("root", "xxx"); auto ds = new ConnectionPoolDataSour

Re: Clarification in continue statement

2015-02-06 Thread Infiltrator via Digitalmars-d-learn
On Friday, 6 February 2015 at 09:43:59 UTC, Rikki Cattermole wrote: On 6/02/2015 10:37 p.m., Vasileios Anagnostopoulos via Digitalmars-d-learn wrote: hi, I observed in the documentation "If continue is followed by /Identifier/, the /Identifier/ must be the label of an enclosing while, for, o

Re: Why hibernated does not create tables automatically?

2015-02-06 Thread Arjan via Digitalmars-d-learn
On Friday, 6 February 2015 at 09:42:09 UTC, zhmt wrote: class Card { import hibernated.core; @Id @Generated long id; @UniqueKey string pwd; } MySQLDriver driver = new MySQLDriver(); string url = MySQLDriver.generateUrl("10.211.55.

Re: Why hibernated does not create tables automatically?

2015-02-06 Thread zhmt via Digitalmars-d-learn
I have submit an issue on github, hope that the author could help me.

Re: Clarification in continue statement

2015-02-06 Thread Rikki Cattermole via Digitalmars-d-learn
On 6/02/2015 10:37 p.m., Vasileios Anagnostopoulos via Digitalmars-d-learn wrote: hi, I observed in the documentation "If continue is followed by /Identifier/, the /Identifier/ must be the label of an enclosing while, for, or do loop, and the next iteration of that loop is executed. It is an e

Re: Why hibernated does not create tables automatically?

2015-02-06 Thread zhmt via Digitalmars-d-learn
class Card { import hibernated.core; @Id @Generated long id; @UniqueKey string pwd; } MySQLDriver driver = new MySQLDriver(); string url = MySQLDriver.generateUrl("10.211.55.10", 3306, "test"); string[string] params = MySQLDriver

Clarification in continue statement

2015-02-06 Thread Vasileios Anagnostopoulos via Digitalmars-d-learn
hi, I observed in the documentation "If continue is followed by *Identifier*, the *Identifier* must be the label of an enclosing while, for, or do loop, and the next iteration of that loop is executed. It is an error if there is no such statement." But there is no example. Can someone provide on

Learning to XML with D

2015-02-06 Thread Derix via Digitalmars-d-learn
So, I set sails to transform a bunch of HTML files with D. This, of course, will happen with the std.xml library. There is this nice example : http://dlang.org/phobos/std_xml.html#.DocumentParser that I put to some use already, however some of the basics seem to escape me, specially in lines li

Re: Why hibernated does not create tables automatically?

2015-02-06 Thread Arjan via Digitalmars-d-learn
On Friday, 6 February 2015 at 08:53:12 UTC, zhmt wrote: The app compiles fine, but It throw an exception when I try to save data to mysql : hibernated.type.MappingException@../../../zhmt/.dub/packages/hibernated-0.2.19/source/hibernated/metadata.d(3332): Cannot find entity by class ezsockacoun

Why hibernated does not create tables automatically?

2015-02-06 Thread zhmt via Digitalmars-d-learn
The app compiles fine, but It throw an exception when I try to save data to mysql : hibernated.type.MappingException@../../../zhmt/.dub/packages/hibernated-0.2.19/source/hibernated/metadata.d(3332): Cannot find entity by class ezsockacount.Dao.Customer My initialization code is something like

Re: D + Solaris

2015-02-06 Thread John Colvin via Digitalmars-d-learn
On Friday, 6 February 2015 at 07:05:01 UTC, Suliman wrote: ldc supports solaris/x86 "but druntime/Phobos support will most likely be lacking" what does it's mean? It is not fully work or what? Where are you quoting that from? If I remember correctly then druntime at least was fully working.

Re: Wrong pointer calculation without casting on struct

2015-02-06 Thread Ali Çehreli via Digitalmars-d-learn
On 02/05/2015 07:59 PM, tcak wrote: > writeln( "Without: ", (&this + id.offsetof) ); In pointer arithmetic, the increment value means "that many *objects* away", not "than many bytes away". Since id.offsetof is 4, you are calculating 4 MessageBase objects away (4*8==32 bytes away). > write