www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Very short article with with manual memory management in C++ and D.

reply "Paulo Pinto" <pjmlp progtools.org> writes:
Hi,

long time ago I wrote a short article about doing manual memory 
management from C++.

http://www.progtools.org/compilers/tutorials/queue/article.html

This was based on a job offer I saw in a games magazine.

Eventually I ported the solution to D, while keeping the code as 
close as possible to the original C++ version.

http://www.progtools.org/compilers/tutorials/queue/queue.cpp.html

http://www.progtools.org/compilers/tutorials/queue/queue.d.html

Since these type of small exercises are the only area where I 
might use D occasionally, are there any issues on the D version 
that could be improved, while keeping the code as close as 
possible to the C++ version?


Thanks,
Paulo
Feb 06 2013
parent reply "MattCoder" <mattcoder hotmail.com> writes:
On Wednesday, 6 February 2013 at 09:36:32 UTC, Paulo Pinto wrote:
 Eventually I ported the solution to D, while keeping the code 
 as close as possible to the original C++ version.
Paulo, can you tell why you chose to keep the D code much as the same the C++ version?
Feb 06 2013
parent reply "Paulo Pinto" <pjmlp progtools.org> writes:
On Wednesday, 6 February 2013 at 10:13:49 UTC, MattCoder wrote:
 On Wednesday, 6 February 2013 at 09:36:32 UTC, Paulo Pinto 
 wrote:
 Eventually I ported the solution to D, while keeping the code 
 as close as possible to the original C++ version.
Paulo, can you tell why you chose to keep the D code much as the same the C++ version?
Languages with stronger type checking, and GC capabilities are usually looked down by some hardcore C++ developers. I just wanted to show that the pointer tricks for memory management are not an exclusivity from C and C++. Maybe I should present two versions, the current one which mimics the C++ version and an improved version. -- Paulo
Feb 06 2013
parent reply "MattCoder" <mattcoder hotmail.com> writes:
On Wednesday, 6 February 2013 at 13:16:45 UTC, Paulo Pinto wrote:
 I just wanted to show that the pointer tricks for memory 
 management are not an exclusivity from C and C++.
I get it! Just one more note, would you have done any benchmark test on between both versions?
Feb 06 2013
parent "Paulo Pinto" <pjmlp progtools.org> writes:
On Wednesday, 6 February 2013 at 21:35:12 UTC, MattCoder wrote:
 On Wednesday, 6 February 2013 at 13:16:45 UTC, Paulo Pinto 
 wrote:
 I just wanted to show that the pointer tricks for memory 
 management are not an exclusivity from C and C++.
I get it! Just one more note, would you have done any benchmark test on between both versions?
Not really, it is very simple code to be worth doing any benchmarks.
Feb 07 2013