port C++ to D - copy constness

2014-06-02 Thread dennis luehring via Digitalmars-d-learn
i want to port this C++ code to good/clean D and have no real idea how to start contains 2 templates - a slice like and a binary reader for an slice main idea was to copy the immutablity of the slice data to the reader http://pastebin.com/XX2yhm8D the example compiles fine with

Re: port C++ to D - copy constness

2014-06-02 Thread dennis luehring via Digitalmars-d-learn
Am 02.06.2014 12:09, schrieb Timon Gehr: On 06/02/2014 09:06 AM, dennis luehring wrote: i want to port this C++ code to good/clean D and have no real idea how to start contains 2 templates - a slice like and a binary reader for an slice main idea was to copy the immutablity of the slice data

Re: Cost of assoc array?

2014-05-14 Thread dennis luehring via Digitalmars-d-learn
Am 14.05.2014 12:33, schrieb Chris: On Wednesday, 14 May 2014 at 10:20:51 UTC, bearophile wrote: Chris: Is there any huge difference as regards performance and memory footprint between the two? Or is 2. basically 1. under the hood? An associative array is a rather more complex data

Re: Cost of assoc array?

2014-05-14 Thread dennis luehring via Digitalmars-d-learn
Am 14.05.2014 15:20, schrieb Chris: Profiling is not really feasible, because for this to work properly, I would have to introduce the change first to be able to compare both. Nothing worse than carefully changing things only to find out, it doesn't really speed up things. why not using an

Re: Interface to Microsoft Access database (Jet)

2014-03-11 Thread dennis luehring
Am 11.03.2014 08:37, schrieb Orfeo: I should extract and process data from Microsoft Access database, and mdbtools is not enough. Is there a library that I can use to query Access? Thanks mdbtools is not enough what is not enough? what version of mdbtools do you use

Re: Interface to Microsoft Access database (Jet)

2014-03-11 Thread dennis luehring
Am 11.03.2014 09:06, schrieb Orfeo: Thank you for github link, I had tried only with mdbtools on http://mdbtools.sourceforge.net/... So, it seems that I can connect using libmdb or odbc ... so everything is fine? or I can not have you any suggestions? answer the question what do you

Re: TLF = thread local functions

2014-01-23 Thread dennis luehring
Am 23.01.2014 15:44, schrieb Frustrated: So, TLS solves the data issue with threading. I just thought, with out much thinking, what about having thread local functions? Doesn't make sense? Let me explain. Functions generally are not thread safe because of reentry, right? The same data is used

Re: Disassembly Tool

2013-11-14 Thread dennis luehring
Am 14.11.2013 10:48, schrieb Namespace: Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there one? And I don't want obj2asm, I'm not willing to pay 15$. maybe: distorm: http://www.ragestorm.net/distorm/ ida freeware:

Re: Which option is faster...

2013-08-07 Thread dennis luehring
Am 07.08.2013 06:30, schrieb jicman: Again, what are you trying to achieve? Your statement is not necessarily true, for a myriad of reasons, but it entirely depends on what you want to do. I would reiterate Dennis Luehring's reply, why are you not benching? It seems like you are guessing at

Re: Getting number of messages in MessageBox

2013-08-06 Thread dennis luehring
Am 06.08.2013 09:30, schrieb Marek Janukowicz: Gabi wrote: Why not go for the trivial solution - just increase/decrease a counter for each push/pop message? Yeah, that's most likely what I'll end up with, but it's a pity such information exists and I only can't access it because someone

Re: Which option is faster...

2013-08-05 Thread dennis luehring
did you benchmarked your current szenario - how do you know that this is the slow part - or are you working on an only-extension-compare-tool? btw: they are both equal and slow - and full of partly code-duplication std.string.tolower(fext[0]) multiple times, i hope your list isn't going much

Re: Which option is faster...

2013-08-05 Thread dennis luehring
it with assembler that would it make million times faster blabla) question: is this the slow part in your project? do you know it for sure or just an emotion - HOW do you benchmark? Am 05.08.2013 16:31, schrieb jicman: On Monday, 5 August 2013 at 14:27:43 UTC, dennis luehring wrote: did you

Re: Which option is faster...

2013-08-05 Thread dennis luehring
Am 05.08.2013 17:18, schrieb jicman: It is a tool that was a script, but I have turned it into do, which now has taken two hours from the last jscript script. I have not benchmarked it, yet. I may. But I see that a great idea has been provided, which I will use. Thanks for the help. have

Re: Socket.select interrupted system call because of GC

2013-08-03 Thread dennis luehring
Am 03.08.2013 08:38, schrieb Marek Janukowicz: void main () { writefln( sa: %d, SA_RESTART ); (new Thread (serverfunc)).start(); (new Thread (clientfunc)).start(); } i have no idea to your main problem but firing threads without any join on the threads in your main program seems very

Re: Socket.select interrupted system call because of GC

2013-08-03 Thread dennis luehring
Am 03.08.2013 13:35, schrieb Marek Janukowicz: dennis luehring wrote: Am 03.08.2013 08:38, schrieb Marek Janukowicz: void main () { writefln( sa: %d, SA_RESTART ); (new Thread (serverfunc)).start(); (new Thread (clientfunc)).start(); } i have no idea to your main problem but firing

Re: Auto keyword with const variable

2013-07-24 Thread dennis luehring
Am 24.07.2013 11:39, schrieb bearophile: Alex H: void test(const int n) { auto j = n; j++; } Gives this error: cannot modify const expression j Is this considered a feature or a bug? I would assume most people wouldn't want new variables inheriting const. It's a bit

Re: Source code output

2013-07-17 Thread dennis luehring
Am 17.07.2013 09:33, schrieb Jacob Carlborg: On 2013-07-17 05:27, JS wrote: With heavy ctfe code generation usage is it possible to have the d compiler output the source code after all mixin templates have been used? This way it is easier to visually check for errors in the generated code. I

Re: Should it be a compile time error?

2013-06-19 Thread dennis luehring
Am 19.06.2013 13:40, schrieb Iain Buclaw: On Wednesday, 19 June 2013 at 11:33:43 UTC, deed wrote: The following compiles and crashes with DMD 2.063. Should this be a compile time error? class A { int _var; /* SNIP */ int var() @property { return var; } Isn't the

Re: Should it be a compile time error?

2013-06-19 Thread dennis luehring
that isn't the problem - D allows assignment to an read property - and there is no write property around, so it should be an compiletime error i should compile only if the missing write property is available - or? @property int var(int value) { return _var = value; } sorry i've totaly lost

Re: Latest GDB version problems

2013-06-02 Thread dennis luehring
the post ist more than 3 years old Am 02.06.2013 07:04, schrieb sha0coder: (gdb) p s $1 = 578159222890430469 No luck :( try this: (gdb) x/dwx mystirng 0xb4f4: 0x003c- size of string (gdb) 0xb4f8: 0xb7ca2540- ptr to the string (gdb) x/s 0xb7ca2540

Re: Why is this code returning the wrong type?

2013-05-23 Thread dennis luehring
Am 23.05.2013 21:45, schrieb Gary Willoughby: Hmmm... Following your example i'm still having problems compiling this simple snippet: import std.stdio; class Example { private FILE _file; public this(string file) { this._file = File(file, r); }

Re: static class

2013-02-18 Thread dennis luehring
Am 17.02.2013 23:25, schrieb Jonathan M Davis: On Sunday, February 17, 2013 23:00:19 Michael wrote: That's not the meaning of static in that context. As I understand a static class can't be instantiated. I have no idea how you came to that conclusion. That's not what it means for a class to

Re: Linker errors and how to catch them

2013-02-18 Thread dennis luehring
Am 18.02.2013 18:37, schrieb Lubos Pintes: Hi, I already did this. I am playing with that library. I converted it so that it uses win32 windows api bindings and fixed a bunch of compile errors. I also converted enum names So_THEY_ARE_NOT_SO_UGLY. :-). Everything worked fine with 2.060. you

is there a way to define a pure base class that forces pureness of derived classes?

2013-02-02 Thread dennis luehring
i've got something like an streaming/converter system and parts of the specialised converters are stateless other statefull is there any way to force pureness/stateless-ness through the base class or an interface in D?

Re: try to compile githubs dmd-master zip with vstudio 2010

2013-01-29 Thread dennis luehring
Am 27.01.2013 15:08, schrieb Namespace: You mean the Visual Studio solution? I tried it also, but for me only the solution above works fine. I asked for that problem here: http://forum.dlang.org/thread/rzvaprvvgdtwrnoto...@forum.dlang.org?page=2#post-ehulzblzddasvyxncvdb:40forum.dlang.org can

try to compile githubs dmd-master zip with vstudio 2010

2013-01-27 Thread dennis luehring
i've grabbed the dmd-master.zip from github an opended the dmd_msc_vs10.sln but i get 3 errors C:\Test\dmd-master\src\mars.c wants missing include verstr.h C:\Test\dmd-master\src\c1xx missing ph.h C:\Test\dmd-master\src\c1xx missing util.c what else is needed to build from source this way?

Re: try to compile githubs dmd-master zip with vstudio 2010

2013-01-27 Thread dennis luehring
and if i want to use the solution file? Am 27.01.2013 14:45, schrieb Namespace: I had the same problem, few days ago. I wrote this short make script [1] which works for me. My solution is that you must clean before, call the vs buildme and then build again with the normal make file. Sounds

Re: Trouble with DLL address

2013-01-14 Thread dennis luehring
Just ignore my post - too early in the morning :( Am 14.01.2013 10:19, schrieb dennis luehring: http://dlang.org/type.html int = signed 32 bits but don't you need long in D Am 14.01.2013 10:13, schrieb dnewbie: I have a DLL which exports a function GetFunction. GetFunction returns a pointer

Re: Trouble with DLL address

2013-01-14 Thread dennis luehring
http://dlang.org/type.html int = signed 32 bits but don't you need long in D Am 14.01.2013 10:13, schrieb dnewbie: I have a DLL which exports a function GetFunction. GetFunction returns a pointer to RealFunction. Now I want to run RealFunction from my D program, but for some reason I get the

Re: Inner function overload bug?

2013-01-09 Thread dennis luehring
Am 08.01.2013 22:43, schrieb Era Scarecrow: On Tuesday, 8 January 2013 at 21:12:34 UTC, Philippe Sigaud wrote: It's conform to the spec http://dlang.org/function.html Last line of the 'nested functions' subsection: Nested functions cannot be overloaded. Nested functions cannot be overloaded.

Re: Inner function overload bug?

2013-01-09 Thread dennis luehring
Am 09.01.2013 14:21, schrieb Philippe Sigaud: On Wed, Jan 9, 2013 at 12:52 PM, Era Scarecrow rtcv...@yahoo.com wrote: That's weird. Why does that work? Directly pasting the mixin content in main() does not compile, right? I can only assume if it does work, that the mixin template has it's

Re: static code generation

2012-12-12 Thread dennis luehring
Am 13.12.2012 04:32, schrieb js.mdnq: I think the issue I have with all this is that when you put code inside a string you lose a lot of compile time features AFAICT. your right - but...try to come up with an similar (easy to implement) powerfull solution that is not based on strings and you

Re: float[] → Vertex[] – decreases performance by 1000%

2012-07-27 Thread dennis luehring
Am 26.07.2012 21:18, schrieb David: Hm. Do you ever do pointer arithmetic on Vertex*? Is the size and offsets are correct (like in Vertex vs float)? No, yes. I really have no idea why this happens, I saved the contents of my buffers and compared them with the buffers of the `float[]` version

Re: Immutability and other attributes, please review

2012-06-15 Thread dennis luehring
Am 15.06.2012 08:25, schrieb Jacob Carlborg: On 2012-06-14 17:32, Roman D. Boiko wrote: I agree, just looking how to accomplish my goals. I decided to get rid of casting, and will store everything on heap. I don't know how to put a variable of type float to the heap, and thought that it would

Re: void pointer syntax

2012-05-16 Thread dennis luehring
Am 14.05.2012 20:40, schrieb Stephen Jones: Ali Çehreli post got your answer - see the last example of the post news://news.digitalmars.com:119/jov3gn$2vtg$1...@digitalmars.com but first: try to understand how the base-class, interface stuff realy works - you will got the same problems in

Re: void pointer syntax

2012-05-16 Thread dennis luehring
Am 16.05.2012 13:12, schrieb Stephen Jones: just throw aways your sensless void pointer or whatever idea - create a base interface or better base-class - everything else is just damn wrong btw: all oop widget sets for c++, java or else are haveing a widget base class that works like people

Re: floats default to NaN... why?

2012-04-14 Thread dennis luehring
Am 14.04.2012 07:48, schrieb F i L: On Saturday, 14 April 2012 at 05:19:38 UTC, dennis luehring wrote: Am 14.04.2012 06:00, schrieb F i L: struct Foo { int x, y;// ready for use. float z, w; // messes things up. float r = 0; // almost always

Re: floats default to NaN... why?

2012-04-13 Thread dennis luehring
Am 14.04.2012 06:00, schrieb F i L: struct Foo { int x, y;// ready for use. float z, w; // messes things up. float r = 0; // almost always... } how often in your code is 0 or 0.0 the real starting point? i can't think of any situation except counters or

Re: DMD/Windows: Inspect generated ASM?

2012-04-08 Thread dennis luehring
ida 5.0 freeware http://www.hex-rays.com/products/ida/support/download_freeware.shtml Am 08.04.2012 14:42, schrieb Stefan: Hi all, Which is the most convenient way to have a look at the ASM code generated by Win-dmd? Unlike gdc, dmd it has no -S option, so I guess I will have to disassemble

Re: parallel unzip in progress

2012-04-04 Thread dennis luehring
Am 04.04.2012 08:31, schrieb Jay Norwood: On Tuesday, 3 April 2012 at 05:27:08 UTC, Jay Norwood wrote: .. So, to answer my own questions ... I placed the code below in a taskpool parallel foreach loop, where each am is an archive member. It is expanded, and the expanded data is

Re: Problem about lambda expressions

2012-03-27 Thread dennis luehring
Am 27.03.2012 15:52, schrieb Tongzhou Li: Oh, I also tried: void seq_apply(Params..., Args...)(void delegate(Params) func, Args args) But I got a error: variadic template parameter must be last Does it mean that there can only be one variadic template parameter? How to fix it? Thanks

Re: HelloWordl in Webserver

2012-03-18 Thread dennis luehring
Am 17.03.2012 21:08, schrieb Xan: I dont' want to battle among languages, its maybe only a library battle but I see that in Golang there is a beatiful solution to display HelloWorld program in web server [rosettacode.org/wiki/Hello_world/Web_server#Go]. no its creates and simple webserver

Re: Raw socket TCP/IP

2012-03-07 Thread dennis luehring
Am 08.02.2012 19:35, schrieb Eyyub: BUMP, I really need help please ! Eyyub. what are you trying to archive? did you got an Ethernet-Frame+IP-Frame+(your replacement for tcp or udp) - or are your trying to change the tcp frame before sending? and if your using Windows:

why have protection attributes on/in interfaces abstract classes/methods no effect ouside a module?

2012-02-03 Thread dennis luehring
why have protection attributes on/in interfaces and abstract classes/methods no effect outside a module? module types; private interface itest { private static void blub(); public void blub2(); private void blub3(); } private class test { protected abstract void blub4(); public

Re: floating-WTF

2012-01-24 Thread dennis luehring
can you give us a complete out-of-the-box compileable example (with imports,main,etc.) with both examples the working/and nonworking does it work correct with dmd(32bit)? is this calculate2 needed to reproduce the behavior? and what compiler did you test: dmd64, (dmd32?), ...? Am 24.01.2012

Re: floating-WTF

2012-01-24 Thread dennis luehring
double works correct under dmd64, but float not? what is the behavior of dmd32 in this szenario?

Re: floating-WTF - Compiler-BUG with 64bit

2012-01-24 Thread dennis luehring
, dennis luehring wrote: can you give us a complete out-of-the-box compileable example (with imports,main,etc.) with both examples the working/and nonworking does it work correct with dmd(32bit)? is this calculate2 needed to reproduce the behavior? and what compiler did you test: dmd64, (dmd32

Re: floating-WTF - Compiler-BUG with 64bit

2012-01-24 Thread dennis luehring
Am 24.01.2012 19:13, schrieb Caligo: How did you compile it? As in my original post, it matters how you compile it. In this case (I'm on a 64-bit GNU/Linux system), compiling with '-inline' doesn't trigger the bug. im on win7 (64bit) - but the windows dmd2.057 isn't able to produce x64 code

Re: associative arrays

2012-01-09 Thread dennis luehring
assert(key in aa); aa.remove(key); So, as far as I can tell, the current situation is more efficient, and it doesn't cost you any expressiveness. You can still have an exception thrown when remove fails if you use enforce before the call if you want an exception thrown when the element isn't

Re: associative arrays

2012-01-09 Thread dennis luehring
Am 09.01.2012 22:08, schrieb Manfred Nowak: dennis luehring wrote: why is there an exception/error neeeded if missing? Exceptions or errors are not _needed_. Their existence stems from the modell under which the user of the operation _has_ to think about the operation, especially whether

Re: d2 file input performance

2011-09-02 Thread dennis luehring
Am 26.08.2011 19:43, schrieb Christian Köstlin: Hi guys, i started the thread: http://stackoverflow.com/questions/7202710/fastest-way-of-reading-bytes-in-d2 on stackoverflow, because i ran into kind of a problem. i wanted to read data from a file (or even better from a stream, but lets stay

Re: Any example of using these Special Tokens?

2011-05-25 Thread dennis luehring
Am 25.05.2011 12:42, schrieb Matthew Ong: On 5/25/2011 5:45 PM, bearophile wrote: Matthew Ong: I am not able make use of these 3 special tokens to print something. writefln(gshared: %s,__gshared); writefln(thread: %s,__thread); writefln(traits: %s,__traits); They are keywords, so

Re: Any example of using these Special Tokens?

2011-05-25 Thread dennis luehring
Am 25.05.2011 10:29, schrieb Matthew Ong: Hi, I am not able make use of these 3 special tokens to print something. writefln(gshared: %s,__gshared); writefln(thread: %s,__thread); writefln(traits: %s,__traits); rc\Sample.d(128):

Re: How to search news group?

2011-05-12 Thread dennis luehring
Am 12.05.2011 15:24, schrieb Matthew Ong: Hi D Forum Admin, I am using the webbase interface for the forum. How to do forum text search instead of browsing over them one by one? Matthew Ong use thunderbird as newsclient

Re: Setting thread priority

2011-02-07 Thread dennis luehring
Am 06.02.2011 02:58, schrieb Peter Alexander: How do you set the priority of a thread, or otherwise control how much CPU time it gets? depends on operating system - on windows: set the priority to high does not help if your system isn't under pressure ...

Re: Nested function declarations

2011-01-29 Thread dennis luehring
They're useful for testing: unittest { int foo(); static assert (is(ReturnType!foo == int)); } and else? is it worth?

Re: about float double

2011-01-19 Thread dennis luehring
Is there somewhere a (clear) doc about float/double internals? Some more particuliar questions: What is the internal bit layout? (mantissa, sign, exponent) Can I assume the integral range is [-2^(m-1) .. 2^�m-1)-1], where m is the number of mantissa bits? What are the values used to

Re: associative array of associative arrays.

2010-08-12 Thread dennis luehring
Am 13.08.2010 01:17, schrieb dcoder: string[string][string] leaders or try using alias to see the light alias string[string] city_info; city_info[string] leaders; Hello. How do you declare and initialize a map that looks like the following: Name = [ Personal Info] Where personal info is

Re: Why assert is in the language?

2010-06-22 Thread dennis luehring
Am 22.06.2010 23:07, schrieb Tomek Sowiñski: Yes, why? It could be implemented in object.d in a similar fashion as std.contracts.enforce. Does it do anything special that a library function couldn't? Tomek what about static assert?

Re: delegates with C linkage

2010-06-06 Thread dennis luehring
Am 06.06.2010 11:33, schrieb Simen kjaeraas: Also, pointers to delegates can be passed to C-linkage functions. A delegate is nothing but a struct, and as such there is no reason for it not to be passable to a C-linkage function. my fault - yes its possible to use delegates in non D but

Re: delegates with C linkage

2010-06-06 Thread dennis luehring
Am 06.06.2010 17:30, schrieb Zarathustra: are delegats part of the ABI, i can't find a delegat calling scheme in the ABI-Description - should this be in EAX, as last/first part on stack, ECX? The delegates are called by exactly same way as any other member function. Put ptr = 'this'(context

Re: delegates with C linkage

2010-06-05 Thread dennis luehring
Am 05.06.2010 13:33, schrieb Zarathustra: Secondly, I'm not sure if you can pass delegates to a C function. C code wouldn't understand delegates. They are not the same as function pointers. I suggest you use function pointers instead, paying attention to linkage. Of course It is possible,

Re: delegates with C linkage

2010-06-05 Thread dennis luehring
Am 05.06.2010 15:42, schrieb Zarathustra: only with static methods - a real delegate needs the this-pointer in a register (not on the stack), thats the main difference between function ptr and delegates, thats why you can't use a (non static) method on for example the win-api callbacks,

Re: delegates with C linkage

2010-06-05 Thread dennis luehring
Am 05.06.2010 16:03, schrieb dennis luehring: Am 05.06.2010 15:42, schrieb Zarathustra: only with static methods - a real delegate needs the this-pointer in a register (not on the stack), thats the main difference between function ptr and delegates, thats why you can't use a (non static